Change vote results to display ex-aequo leading options as leading (#12001)

lolsob-rspec
ThibG 2019-09-29 21:23:40 +02:00 committed by Eugen Rochko
parent 7918c98190
commit 812a7828d1
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ class Poll extends ImmutablePureComponent {
renderOption (option, optionIndex, showResults) { renderOption (option, optionIndex, showResults) {
const { poll, disabled, intl } = this.props; const { poll, disabled, intl } = this.props;
const percent = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100; const percent = poll.get('votes_count') === 0 ? 0 : (option.get('votes_count') / poll.get('votes_count')) * 100;
const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') > other.get('votes_count')); const leading = poll.get('options').filterNot(other => other.get('title') === option.get('title')).every(other => option.get('votes_count') >= other.get('votes_count'));
const active = !!this.state.selected[`${optionIndex}`]; const active = !!this.state.selected[`${optionIndex}`];
const voted = option.get('voted') || (poll.get('own_votes') && poll.get('own_votes').includes(optionIndex)); const voted = option.get('voted') || (poll.get('own_votes') && poll.get('own_votes').includes(optionIndex));