aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-06-06 04:47:55 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2008-06-06 04:47:55 +0000
commit28df07fc7df8457a92ce131eefd3ac93f734e3dc (patch)
tree0e00f0195713adea116b2d2a36e9a85eaad79a71
parentimplement bugstats. (diff)
downloadrbot-bugzilla-28df07fc7df8457a92ce131eefd3ac93f734e3dc.tar.gz
rbot-bugzilla-28df07fc7df8457a92ce131eefd3ac93f734e3dc.tar.bz2
rbot-bugzilla-28df07fc7df8457a92ce131eefd3ac93f734e3dc.zip
Include ability to do totals in the reports.
-rw-r--r--bugzilla.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/bugzilla.rb b/bugzilla.rb
index fe8a2b5..7987b82 100644
--- a/bugzilla.rb
+++ b/bugzilla.rb
@@ -352,9 +352,19 @@ class BugzillaPlugin < Plugin
self.lastseenid = buglist[-1][0].to_i if buglist.size > 0
end
- def report(params)
- url = "#{reporturl}&#{params}"
+ def report(urlparams, params = nil)
+ url = "#{reporturl}&#{urlparams}"
reportdata = CSV::Reader.create(@bot.httputil.get(url)).to_a
+ if params and params[:total]
+ sum = 0
+ column = params[:total]
+ reportdata.each do |row|
+ if row[column] =~ /^[0-9]+$/
+ sum += row[column].to_i
+ end
+ end
+ reportdata << ["Total", sum]
+ end
return reportdata
end
@@ -497,7 +507,7 @@ class BugzillaPlugin < Plugin
#reso.each { |r| query += "&resolution=#{r}" }
# Get the data
- results = zilla.report(query)
+ results = zilla.report(query, {:total => 1})
# Remove the CSV header
results.shift
@@ -628,7 +638,7 @@ class BugzillaPlugin < Plugin
reso.each { |r| query += "&resolution=#{r}" }
# Get the data
- results = zilla.report(query)
+ results = zilla.report(query, {:total => 1})
# Remove the CSV header
results.shift