bin/cobench in cobench-0.0.25 vs bin/cobench in cobench-0.0.26
- old
+ new
@@ -77,10 +77,15 @@
def div(a, b)
return 0 if b == 0
a / b
end
+def actual(ms)
+ return ms[:actual] if ms.key?(:actual)
+ ms[:total]
+end
+
def build_xml(opts, loog)
if opts.token?
api = Octokit::Client.new(:access_token => opts[:token])
else
api = Octokit::Client.new
@@ -153,14 +158,14 @@
end.inject(0, :+)
data[u]['Score'] = { total: score }
end
averages = {
'HpP': {
- f: lambda { |ms| div(ms['HoC'][:total], ms['Pulls'][:total]) },
+ f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Pulls'])) },
title: 'HoC per Pull'
},
'HpC': {
- f: lambda { |ms| div(ms['HoC'][:total], ms['Commits'][:total]) },
+ f: lambda { |ms| div(actual(ms['HoC']), actual(ms['Commits'])) },
title: 'HoC per Commit'
}
}
data.each do |u, ms|
averages.each do |k, a|