FIX: Sort is destructive and that is not what we want.
This commit is contained in:
parent
74d73f9e06
commit
115a1c8680
|
@ -135,10 +135,10 @@ createWidget('discourse-poll-standard-results', {
|
||||||
html(attrs) {
|
html(attrs) {
|
||||||
const { poll } = attrs;
|
const { poll } = attrs;
|
||||||
const options = poll.get('options');
|
const options = poll.get('options');
|
||||||
if (options) {
|
|
||||||
|
|
||||||
|
if (options) {
|
||||||
const voters = poll.get('voters');
|
const voters = poll.get('voters');
|
||||||
const ordered = options.sort((a, b) => {
|
const ordered = _.clone(options).sort((a, b) => {
|
||||||
if (a.votes < b.votes) {
|
if (a.votes < b.votes) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (a.votes === b.votes) {
|
} else if (a.votes === b.votes) {
|
||||||
|
|
Loading…
Reference in New Issue