Class: Twigg::Gerrit::Author

Inherits:
Object
  • Object
show all
Defined in:
lib/twigg-gerrit/gerrit/author.rb

Overview

Author-centric stats for activity on Gerrit (commenting, reviewing) and “quality” (attracting comments, pushing multiple patch sets).

Class Method Summary collapse

Class Method Details

.stats(days: 7) ⇒ Object

Returns a Hash of stats where the keys are author names and the values are hashes containing stats (keys: stat labels, values: counts).



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/twigg-gerrit/gerrit/author.rb', line 10

def stats(days: 7)
  Hash.new { |h, k| h[k] = {} }.tap do |hash|
    {
      comments_posted:         comments_posted(days),
      comments_received:       comments_received(days),
      recently_active_changes: recently_active_changes(days),
      revisions_pushed:        revisions_pushed(days),
      scores_assigned:         scores_assigned(days),
    }.each do |label, stats|
      stats.each do |author_stats|
        hash[author_stats[:full_name]][label] = author_stats[:count]
      end
    end
  end
end