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:
pkuanvil-uid1 2023-03-11 01:03:59 +08:00 committed by GitHub
parent 30e452d326
commit f0e11a34a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);