diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-02-10 21:07:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-10 21:07:48 +0100 |
commit | 776e337b8d2aa66440bc4565617b5440ca781e1a (patch) | |
tree | d9d30c63622c58a343cea58a3509337630491609 /app/models/poll.rb | |
parent | d602c92b310545eb733a58caed49717341abe27c (diff) | |
parent | 642b5a621acdcae091f8bdb0f367018309616f71 (diff) |
Merge pull request #1683 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/models/poll.rb')
-rw-r--r-- | app/models/poll.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/poll.rb b/app/models/poll.rb index 71b5e191f..ba08309a1 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -83,6 +83,12 @@ class Poll < ApplicationRecord end end + def reset_votes! + self.cached_tallies = options.map { 0 } + self.votes_count = 0 + votes.delete_all unless new_record? + end + private def prepare_cached_tallies |