From 2a66e5ce6968703979bcbe6e9eec188c03bf9bd5 Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Fri, 6 Jun 2008 04:37:34 +0000 Subject: implement bugstats. --- bugzilla.rb | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/bugzilla.rb b/bugzilla.rb index 16ad676..fe8a2b5 100644 --- a/bugzilla.rb +++ b/bugzilla.rb @@ -476,6 +476,40 @@ class BugzillaPlugin < Plugin end end + # Produce support of all bug status counts + def bugstats(m, params) + begin + if params[:zilla] + check_zilla(params[:zilla]) + zilla = @zillas[params[:zilla]] + elsif get_zilla(m) + zilla = get_zilla(m) + else + m.reply "Wrong parameters (no bugzilla specified), see 'help bugstats' for help." + return + end + + title = "#{zilla.name.capitalize} bug status totals" + + # Build our URL + query = 'x_axis_field=bug_status' + #status.each { |s| query += "&bug_status=#{s}" } + #reso.each { |r| query += "&resolution=#{r}" } + + # Get the data + results = zilla.report(query) + + # Remove the CSV header + results.shift + + # Display output + m.reply title+" "+(results.map { |b| "#{b[0]}(#{b[1]})" }.join(' ')) + + rescue ::Exception => e + m.reply e.message + end + end + # Produce architecture statistics using Bugzilla reports # # Using the bugzilla reporting functionality, we can produce a @@ -878,6 +912,16 @@ plugin.map 'bug :zilla :number', :action => 'bug', :auth_path => 'view' +plugin.map 'bugstats :zilla', + :requirements => { + :zilla => /^[^ ]+$/, + }, + :defaults => { + :zilla => nil, + }, + :action => 'bugstats', + :auth_path => 'view' + plugin.map 'archstats :zilla :status :reso', :requirements => { :status => STATUS_INPUT_N, -- cgit v1.2.3-65-gdbad