# Module Votes

- app/roles/votes.rb

Methods

D
  - downvotes,
  - downvotes_in_percent
U
  - upvotes,
  - upvotes_in_percent
V
  - votes_count

Instance Public methods
downvotes() Link

Return the number of -1 comments (downvotes)

Source: show

    # File app/roles/votes.rb, line 16
    def downvotes
      notes.select(&:downvote?).size
    end

downvotes_in_percent() Link

Source: show

    # File app/roles/votes.rb, line 20
    def downvotes_in_percent
      if votes_count.zero?
        0
      else
        100.0 - upvotes_in_percent
      end
    end

upvotes() Link

Return the number of +1 comments (upvotes)

Source: show

    # File app/roles/votes.rb, line 3
    def upvotes
      notes.select(&:upvote?).size
    end

upvotes_in_percent() Link

Source: show

    # File app/roles/votes.rb, line 7
    def upvotes_in_percent
      if votes_count.zero?
        0
      else
        100.0 / votes_count * upvotes
      end
    end

votes_count() Link

Return the total number of votes

Source: show

    # File app/roles/votes.rb, line 29
    def votes_count
      upvotes + downvotes
    end