Closed il3ven closed 2 years ago
Earlier the result from votes.tally used to look like,
votes.tally
[ { optionID: '2467y3kRa3s5m7KVsoojqbqsvLZ', votes: 2, }, { optionID: '2467y7Ia1Oy04GB7CTmZfEp6lUm', votes: 1, } ]
Now, they look like,
[ { optionID: '2467y3kRa3s5m7KVsoojqbqsvLZ', votes: 2, text: 'Tomatos' }, { optionID: '2467y7Ia1Oy04GB7CTmZfEp6lUm', votes: 1, text: 'Bananas' }, { optionID: '2467y4CYJ22UX2LPlCkYUIqz0j9', votes: 0, text: 'I like hamsters' } ]
This PR fixes the test according to the above mentioned change.
After changing the tests I found them to be still failing. That's when I found a bug in db.mjs.
db.mjs
for (let option of question.options) { - const included = result.find(({ optionId }) => optionId === option.ksuid); + const included = result.find(({ optionID }) => optionID === option.ksuid); if (!included) { - result.push({ optionId: option.ksuid, votes: 0 }); + result.push({ optionID: option.ksuid, votes: 0, text: option.name }); } }
thank you very much
Earlier the result from
votes.tally
used to look like,Now, they look like,
This PR fixes the test according to the above mentioned change.
After changing the tests I found them to be still failing. That's when I found a bug in
db.mjs
.