[bugzilla-gnome-org-extensions] patch report: Add a GNOME specific open bug statuses getter



commit 5846202c35be9c9797bccde43a104ea1b398dba4
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Wed Nov 19 13:37:39 2014 +0100

    patch report: Add a GNOME specific open bug statuses getter

 PatchReport/lib/Status.pm |   26 ++++++++++++++++++++++++++
 PatchReport/lib/Util.pm   |   12 ++++++++----
 2 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/PatchReport/lib/Status.pm b/PatchReport/lib/Status.pm
new file mode 100644
index 0000000..a3eca90
--- /dev/null
+++ b/PatchReport/lib/Status.pm
@@ -0,0 +1,26 @@
+package Bugzilla::Extension::PatchStatus::Status;
+
+use strict;
+use warnings;
+use Bugzilla::Status;
+
+sub _filtered_open_states {
+    my @filtered = grep { $_ ne "NEEDINFO" } BUG_STATE_OPEN;
+
+    return \ filtered;
+}
+
+sub gnome_open_statuses {
+    my $dbh = Bugzilla->dbh();
+    my $cache = Bugzilla->request_cache();
+
+    $cache->{'gnome_open_bug_statuses'} ||= _filtered_open_states();
+
+    return @{$cache->{'gnome_open_bug_statuses'}};
+}
+
+BEGIN {
+    *Bugzilla::Status::gnome_open_statuses = \&gnome_open_statuses;
+}
+
+1;
diff --git a/PatchReport/lib/Util.pm b/PatchReport/lib/Util.pm
index 88456c2..ef44c0e 100644
--- a/PatchReport/lib/Util.pm
+++ b/PatchReport/lib/Util.pm
@@ -21,6 +21,7 @@ use Bugzilla::Constants;
 use Bugzilla::Error;
 use Bugzilla::Util;
 use Bugzilla::User;
+use Bugzilla::Extension::PatchReport::Status;
 
 our @EXPORT = qw(
     page
@@ -112,6 +113,12 @@ sub _page_patch_report {
     $vars->{'stats'} = $stats;
 }
 
+sub browse_open_states {
+    my $dbh = Bugzilla->dbh;
+
+    return join(',', map { $dbh->quote($_) } Bugzilla::Status->gnome_open_statuses());
+}
+
 sub get_unreviewed_patches_and_stats {
     my ($quoted_product, $quoted_component, $patch_status,
         $min_days, $max_days, $submitter) = (@_);
@@ -159,10 +166,7 @@ sub get_unreviewed_patches_and_stats {
     if ($patch_status ne 'obsolete') {
         $query .= " AND attachments.gnome_attachment_status = '" . $patch_status . "'";
     }
-    $query .= "   AND (bugs.bug_status = 'UNCONFIRMED'
-                       OR bugs.bug_status = 'NEW'
-                       OR bugs.bug_status = 'ASSIGNED'
-                       OR bugs.bug_status = 'REOPENED')
+    $quert .= "   AND (bugs.bug_status IN (" . browse_open_states() . ")
              ORDER BY products.name, components.name, attachments.bug_id, attachments.attach_id";
 
     my $sth = $dbh->prepare($query);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]