mirror of
https://github.com/discourse/discourse.git
synced 2025-06-06 03:06:53 +08:00
FEATURE: 2 new reports: time to first response, topics with no response
FIX: relativeAgeMediumSpan was off by 1 REFACTOR: extracted decimalAdjust & round functions from the poll plugin
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import round from "discourse/plugins/poll/lib/round";
|
||||
import round from "discourse/lib/round";
|
||||
|
||||
export default Em.Component.extend({
|
||||
tagName: "span",
|
||||
|
@ -1,16 +0,0 @@
|
||||
// from: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/floor
|
||||
|
||||
export default function(type, value, exp) {
|
||||
// If the exp is undefined or zero...
|
||||
if (typeof exp === 'undefined' || +exp === 0) { return Math[type](value); }
|
||||
value = +value;
|
||||
exp = +exp;
|
||||
// If the value is not a number or the exp is not an integer...
|
||||
if (isNaN(value) || !(typeof exp === 'number' && exp % 1 === 0)) { return NaN; }
|
||||
// Shift
|
||||
value = value.toString().split('e');
|
||||
value = Math[type](+(value[0] + 'e' + (value[1] ? (+value[1] - exp) : -exp)));
|
||||
// Shift back
|
||||
value = value.toString().split('e');
|
||||
return +(value[0] + 'e' + (value[1] ? (+value[1] + exp) : exp));
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
import decimalAdjust from "discourse/plugins/poll/lib/decimal-adjust";
|
||||
|
||||
export default function(value, exp) {
|
||||
return decimalAdjust("round", value, exp);
|
||||
}
|
Reference in New Issue
Block a user