Skip to content
Snippets Groups Projects
Unverified Commit f17fc574 authored by afontenot's avatar afontenot Committed by GitHub
Browse files

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
parent 95b24c51
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment