aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-06-04 09:24:35 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2008-06-04 09:24:35 +0000
commitd2c70985105396072d6d695e47eb2ac5b69e48c5 (patch)
tree5c9c8e79e1da7e74984bd35c2fe73df375ed2784
parentAllow regex for channels, or non-regex for usernames. (diff)
downloadrbot-bugzilla-d2c70985105396072d6d695e47eb2ac5b69e48c5.tar.gz
rbot-bugzilla-d2c70985105396072d6d695e47eb2ac5b69e48c5.tar.bz2
rbot-bugzilla-d2c70985105396072d6d695e47eb2ac5b69e48c5.zip
Archstats is nearly perfect. Needs a little more work on the params.
-rw-r--r--bugzilla.rb42
1 files changed, 30 insertions, 12 deletions
diff --git a/bugzilla.rb b/bugzilla.rb
index d185d5e..7e86c85 100644
--- a/bugzilla.rb
+++ b/bugzilla.rb
@@ -466,6 +466,9 @@ class BugzillaPlugin < Plugin
begin
status = params[:status]
reso = params[:reso]
+
+ status = ['ALL'] unless status
+ reso = [] unless reso
status = status.split(/,/)
status.each do |s|
@@ -476,29 +479,45 @@ class BugzillaPlugin < Plugin
reso.each do |r|
raise ENotFound.new("Invalid resolution (#{r}), see 'help archstats' for help.") if not VALID_RESO.include?(r)
end
- query = 'x_axis_field=rep_platform'
- status.each { |s| query += "&bug_status=#{s}" }
- reso.each { |r| query += "&resolution=#{r}" }
-
title = "Platform bug totals"
- if status or reso
+ if status.length > 0 or reso.length > 0
title += " (#{status.join(',')}"
- title += "/#{reso.join(',')} " if reso
+ title += "/#{reso.join(',')} " if reso.length > 0
title += ")"
end
+ status.delete('ALL')
+
+ if status.include?('OPEN')
+ status += OPEN_STATUS
+ status.uniq!
+ status.delete('OPEN')
+ end
+
+ if status.include?('DONE')
+ status += DONE_STATUS
+ status.uniq!
+ status.delete('DONE')
+ end
+
+ query = 'x_axis_field=rep_platform'
+ status.each { |s| query += "&bug_status=#{s}" }
+ reso.each { |r| query += "&resolution=#{r}" }
+
if params[:zilla]
check_zilla(params[:zilla])
results = @zillas[params[:zilla]].report(query)
- msg = results.each { |b| " #{b[0]}(#{b[1]})" }
- m.reply "#{title} #{msg}"
elsif @defaults[m.replyto][:zilla] and @zillas[@defaults[m.replyto][:zilla]]
results = @zillas[@defaults[m.replyto][:zilla]].report(query)
- msg = results.each { |b| " #{b[0]}(#{b[1]})" }
- m.reply "#{title} #{msg}"
else
m.reply "Wrong parameters, see 'help archstats' for help."
+ return
end
+
+ results.shift
+ msg = results.map { |b| "#{b[0]}(#{b[1]})" }.join(' ')
+ m.reply "#{title} #{msg}"
+
rescue ::Exception => e
m.reply e.message
end
@@ -782,8 +801,7 @@ plugin.map 'archstats :zilla :status :reso',
},
:defaults => {
:status => 'ALL',
- :resolution => [],
- :zilla => nil
+ :resolution => '',
},
:auth_path => 'view'