diff options
author | afontenot <adam.m.fontenot@gmail.com> | 2022-11-26 14:08:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-26 23:08:25 +0100 |
commit | f17fc5742e539db10e0e430f5218c440849b894c (patch) | |
tree | 53dc0a958d48912333ab8f64759a5ce817106c01 | |
parent | 95b24c51ece406ee50a67c9682fd5bd887d927e5 (diff) |
Clear voter count when poll is reset (#21700)
When a poll is edited, we reset the poll and remove all previous votes. However, prior to this commit, the voter count on the poll was not reset. This leads to incorrect percentages being shown in poll results. Fixes #21696
-rw-r--r-- | app/models/poll.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/poll.rb b/app/models/poll.rb index 1a326e452..af3b09315 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -85,6 +85,7 @@ class Poll < ApplicationRecord def reset_votes! self.cached_tallies = options.map { 0 } self.votes_count = 0 + self.voters_count = 0 votes.delete_all unless new_record? end |