mirror of
https://hk.gh-proxy.com/https://github.com/NodeBB/nodebb-plugin-poll.git
synced 2025-10-04 04:41:13 +08:00
Fix issue #133
This should fix wrong order of post items. We preserve the order as in `Poll.add()` when `pollData.options` get indexed by consecutive option id.
This commit is contained in:
parent
30e452d326
commit
f0e11a34a0
1 changed files with 3 additions and 0 deletions
|
@ -132,6 +132,9 @@ const Scheduler = require('./scheduler');
|
|||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
// sort options according to option id. option id are supposed to preseve the order as in Poll.add(),
|
||||
// when the user create the poll
|
||||
options.sort((a, b) => a - b);
|
||||
async.map(options, (option, next) => {
|
||||
Poll.getOption(pollId, option, withVotes, next);
|
||||
}, callback);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue