Skip to content

Commit

Permalink
Merge pull request #434 from datafruits/fix-voting-completion-percentage
Browse files Browse the repository at this point in the history
fix shrimpo voting completion bug
  • Loading branch information
mcfiredrill authored Oct 12, 2024
2 parents 463fed6 + 19c81e3 commit 2f6800e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/shrimpo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def create_entries_zip
end

def voting_completion user
voted_count = ShrimpoVote.where(user: user).where("shrimpo_entry_id in (?)", self.shrimpo_entries.pluck(:id)).count
voted_count = ShrimpoVote.where(user: user).where("shrimpo_entry_id in (?)", self.shrimpo_entries.pluck(:id)).select(:shrimpo_entry_id).distinct.count
total_count = self.shrimpo_entries.count
(voted_count.to_f / total_count.to_f) * 100
((voted_count.to_f / total_count.to_f) * 100).round(2)
end

private
Expand Down

0 comments on commit 2f6800e

Please sign in to comment.