Skip to content
Snippets Groups Projects

Update votes for issues and merge requests

Merged gitlab-qa-bot requested to merge github/fork/riyad/update-votes into master

Created by: riyad

Votes for issues and merge requests are updated.

  • downvotes are also recognized
  • instead of just counting votes, a bar with up vs. down votes is displayed
  • buttons on the issue details page are now also colored and the same size as those on the MR details page

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
Unable to load the diff
  • Created by: dzaporozhets

    Move logic to helper or decorator or role. Same for issue

    By Administrator on 2012-09-11T21:42:56 (imported from GitLab project)

    By Administrator on 2012-09-11T21:42:56 (imported from GitLab)

  • gitlab-qa-bot
  • Unable to load the diff
    • Created by: riyad

      You are right. :) I'll work on it.

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab project)

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab)

  • Created by: riyad

    Better? :)

    By Administrator on 2012-09-10T20:16:18 (imported from GitLab project)

    By Administrator on 2012-09-10T20:16:18 (imported from GitLab)

  • gitlab-qa-bot
  • 1 module Votes
    2 # Return the number of +1 comments (upvotes)
    3 def upvotes
    4 notes.select(&:upvote?).size
    5 end
    6
    7 def upvotes_in_percent
    8 if votes_count.zero?
    9 0
    10 else
    11 100.0 / votes_count * upvotes
    12 end
    • Created by: NARKOZ

      votes_count.zero? ? votes_count : (100.0 / votes_count * upvotes)

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab project)

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab)

  • gitlab-qa-bot
  • 11 100.0 / votes_count * upvotes
    12 end
    13 end
    14
    15 # Return the number of -1 comments (downvotes)
    16 def downvotes
    17 notes.select(&:downvote?).size
    18 end
    19
    20 def downvotes_in_percent
    21 if votes_count.zero?
    22 0
    23 else
    24 100.0 - upvotes_in_percent
    25 end
    26 end
    • Created by: NARKOZ

      ternary operator + spaces around operators

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab project)

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab)

  • Created by: icholy

    +1

    By Administrator on 2012-09-11T04:50:09 (imported from GitLab project)

    By Administrator on 2012-09-11T04:50:09 (imported from GitLab)

  • gitlab-qa-bot
  • 1 module Votes
    2 # Return the number of +1 comments (upvotes)
    3 def upvotes
    4 notes.select(&:upvote?).size
    5 end
    6
    7 def upvotes_in_percent
    8 if votes_count.zero?
    9 0
    10 else
    11 100.0 / votes_count * upvotes
    12 end
    • Created by: riyad

      Actually, this was deliberate. :) I explicitly try to avoid the ternary operator in Ruby ... I think they are bad style. It generally hurts legebility, especially if you have a foo? call or handle :symbols.

      I might agree on the use of spaces though. ;)

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab project)

      By Administrator on 2012-09-11T21:42:56 (imported from GitLab)

  • Created by: riyad

    Updated once more. :)

    By Administrator on 2012-09-11T21:43:48 (imported from GitLab project)

    By Administrator on 2012-09-11T21:43:48 (imported from GitLab)

  • gitlab-qa-bot
  • 1 module Votes
    2 # Return the number of +1 comments (upvotes)
    3 def upvotes
    4 notes.select(&:upvote?).size
    5 end
    6
    7 def upvotes_in_percent
    8 if votes_count.zero?
    9 0
    10 else
    11 100.0 / votes_count * upvotes
    12 end
    • Created by: NARKOZ

      I explicitly try to avoid the ternary operator in Ruby ... I think they are bad style.

      Don't worry about it. It's a good practice in Ruby, tho.

      By Administrator on 2012-09-12T05:28:57 (imported from GitLab project)

      By Administrator on 2012-09-12T05:28:57 (imported from GitLab)

    Please register or sign in to reply
    Loading