Browse Source

Fix NaN in Poll component (#10213)

closed-social-v3
Eugen Rochko 5 years ago
committed by GitHub
parent
commit
75cb93676b
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      app/javascript/mastodon/components/poll.js

+ 1
- 1
app/javascript/mastodon/components/poll.js View File

@ -94,7 +94,7 @@ class Poll extends ImmutablePureComponent {
renderOption (option, optionIndex) {
const { poll, disabled } = this.props;
const percent = (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 active = !!this.state.selected[`${optionIndex}`];
const showResults = poll.get('voted') || poll.get('expired');

Loading…
Cancel
Save