Migrate Discourse Polls to use vdom instead of embedded ember

This commit is contained in:
Robin Ward
2016-12-07 15:48:47 -05:00
parent 846597f563
commit f07443b488
23 changed files with 702 additions and 620 deletions

View File

@ -3,7 +3,7 @@ function sumsUpTo100(percentages) {
return percentages.map(p => Math.floor(p)).reduce((a, b) => a + b) === 100;
}
export default (percentages) => {
export default function(percentages) {
var decimals = percentages.map(a => a % 1);
const sumOfDecimals = Math.ceil(decimals.reduce((a, b) => a + b));
// compensate error by adding 1 to n items with the greatest decimal part