mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 14:12:10 +08:00
FIX: Sort is destructive and that is not what we want.
This commit is contained in:
@ -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) {
|
||||||
|
Reference in New Issue
Block a user