FIX: Incorrect sort for poll results.

This commit is contained in:
Guo Xiang Tan
2016-07-29 14:42:55 +08:00
parent f9ef1e1997
commit e336e56153
2 changed files with 9 additions and 2 deletions

View File

@@ -8,7 +8,7 @@ export default Em.Component.extend({
@computed("poll.voters", "poll.type", "poll.options.[]")
options(voters, type) {
const options = this.get("poll.options").slice(0).sort((a, b) => {
return a.get("votes") < b.get("votes") ? 1 : 0;
return b.get("votes") - a.get("votes");
});
let percentages = voters === 0 ?