Return the number of -1 comments (downvotes)
# File app/roles/votes.rb, line 16 def downvotes notes.select(&:downvote?).size end
# File app/roles/votes.rb, line 20 def downvotes_in_percent if votes_count.zero? 0 else 100.0 - upvotes_in_percent end end
Return the number of +1 comments (upvotes)
# File app/roles/votes.rb, line 3 def upvotes notes.select(&:upvote?).size end
# File app/roles/votes.rb, line 7 def upvotes_in_percent if votes_count.zero? 0 else 100.0 / votes_count * upvotes end end
Return the total number of votes
# File app/roles/votes.rb, line 29 def votes_count upvotes + downvotes end