[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.9.6-346-gb6fd75f

Alex Vandiver alexmv at bestpractical.com
Fri Dec 3 16:29:34 EST 2010


The branch, 3.9-trunk has been updated
       via  b6fd75f660b44f4842a9a0587ca533800763f106 (commit)
      from  6c7977faebe6427aca6c8881f7fafbcd64a7781c (commit)

Summary of changes:
 share/html/Elements/QueueSummaryByLifecycle |   35 ++++++++++++++------------
 1 files changed, 19 insertions(+), 16 deletions(-)

- Log -----------------------------------------------------------------
commit b6fd75f660b44f4842a9a0587ca533800763f106
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Fri Dec 3 16:27:43 2010 -0500

    By doing the ticket search later, we can limit on queue and status
    
    This allows us to make use of the (Status, Queue) index

diff --git a/share/html/Elements/QueueSummaryByLifecycle b/share/html/Elements/QueueSummaryByLifecycle
index b36d025..8473a9d 100644
--- a/share/html/Elements/QueueSummaryByLifecycle
+++ b/share/html/Elements/QueueSummaryByLifecycle
@@ -88,22 +88,6 @@ for my $queue (@queues) {
 % }
 <%INIT>
 
-my $data     = {};
-my $statuses = {};
-
-use RT::Report::Tickets;
-my $report = RT::Report::Tickets->new( RT->SystemUser );
-$report->SetupGroupings( Query => 'id > 0', GroupBy => [qw(Status Queue)] );
-
-while ( my $entry = $report->Next ) {
-    $data->{ $entry->__Value("Queue") }->{ $entry->__Value("Status") }
-        = $entry->__Value('id');
-    $statuses->{ $entry->__Value("Status") } = 1;
-}
-
-
-
-
 my @queues;
 my $Queues = RT::Queues->new( $session{'CurrentUser'} );
 $Queues->UnLimit();
@@ -135,6 +119,25 @@ unless (@statuses) {
     }
 }
 
+my $data     = {};
+my $statuses = {};
+
+use RT::Report::Tickets;
+my $report = RT::Report::Tickets->new( RT->SystemUser );
+my $query =
+    "(".
+    join(" OR ", map {s{(['\\])}{\\$1}g; "Status = '$_'"} @statuses) #'
+    .") AND (".
+    join(' OR ', map "Queue = ".$_->{id}, @queues)
+    .")";
+$report->SetupGroupings( Query => $query, GroupBy => [qw(Status Queue)] );
+warn $report->BuildSelectQuery;
+
+while ( my $entry = $report->Next ) {
+    $data->{ $entry->__Value("Queue") }->{ $entry->__Value("Status") }
+        = $entry->__Value('id');
+    $statuses->{ $entry->__Value("Status") } = 1;
+}
 </%INIT>
 <%ARGS>
 $cache => undef

-----------------------------------------------------------------------


More information about the Rt-commit mailing list