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:
Régis Hanol
2015-06-22 19:46:51 +02:00
parent 0bfabed2d5
commit b25a16ee3e
10 changed files with 101 additions and 10 deletions

View File

@ -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",

View File

@ -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));
}

View File

@ -1,5 +0,0 @@
import decimalAdjust from "discourse/plugins/poll/lib/decimal-adjust";
export default function(value, exp) {
return decimalAdjust("round", value, exp);
}