lib/cobench/metrics/reviews.rb in cobench-0.0.47 vs lib/cobench/metrics/reviews.rb in cobench-0.0.48
- old
+ new
@@ -41,9 +41,14 @@
total = json.items.count do |p|
pr = p.pull_request.url.split('/')[-1]
repo = p.repository_url.split('/')[-2..-1].join('/')
next unless Cobench::Match.new(@opts, loog).matches?(repo)
loog.debug("Including #{repo}##{pr} reviewed by @#{@user}")
+ reviews = @api.pull_request_reviews(repo, pr).count { |c| c[:user][:login].downcase == @user }
+ if reviews.zero?
+ loog.debug("There are no reviews in #{repo}##{pr} by @#{@user}")
+ next
+ end
posted = @api.pull_request_comments(repo, pr).count { |c| c[:user][:login].downcase == @user }
posted += @api.issue_comments(repo, pr).count { |c| c[:user][:login].downcase == @user }
loog.debug("#{posted} messages posted by @#{@user} to #{repo}##{pr}")
msgs += posted
end