[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.7-154-ge25358c

jesse jesse at bestpractical.com
Tue Feb 16 10:22:19 EST 2010


The branch, 3.8-trunk has been updated
       via  e25358cd1f5f85ce52638537383055c7dfe0eeb6 (commit)
      from  fd60fd33287448352ba615856501615d54305030 (commit)

Summary of changes:
 lib/RT/Report/Tickets.pm |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

- Log -----------------------------------------------------------------
commit e25358cd1f5f85ce52638537383055c7dfe0eeb6
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Tue Feb 16 07:14:02 2010 -0800

    Added "hourly" variant for our ticket search result charts

diff --git a/lib/RT/Report/Tickets.pm b/lib/RT/Report/Tickets.pm
index c539ab1..05f0100 100644
--- a/lib/RT/Report/Tickets.pm
+++ b/lib/RT/Report/Tickets.pm
@@ -68,14 +68,13 @@ sub Groupings {
         );
     }
 
-    push @fields, map {$_, $_} qw(
-        DueDaily DueMonthly DueAnnually
-        ResolvedDaily ResolvedMonthly ResolvedAnnually
-        CreatedDaily CreatedMonthly CreatedAnnually
-        LastUpdatedDaily LastUpdatedMonthly LastUpdatedAnnually
-        StartedDaily StartedMonthly StartedAnnually
-        StartsDaily StartsMonthly StartsAnnually
-    );
+
+    for my $field (qw(Due Resolved Created LastUpdated Started Starts)) {
+        for my $frequency (qw(Hourly Daily Monthly Annually)) {
+            my $item = $field.$frequency;
+            push @fields,  $item,  $item;
+        }
+    }
 
     my $queues = $args{'Queues'};
     if ( !$queues && $args{'Query'} ) {
@@ -183,11 +182,14 @@ sub _FieldToFunction {
 
     my $field = $args{'FIELD'};
 
-    if ($field =~ /^(.*)(Daily|Monthly|Annually)$/) {
+    if ($field =~ /^(.*)(Hourly|Daily|Monthly|Annually)$/) {
         my ($field, $grouping) = ($1, $2);
         my $alias = $args{'ALIAS'} || 'main';
         # Pg 8.3 requires explicit casting
         $field .= '::text' if RT->Config->Get('DatabaseType') eq 'Pg';
+        if ( $grouping =~ /Hourly/ ) {
+            $args{'FUNCTION'} = "SUBSTR($alias.$field,1,13)";
+        }
         if ( $grouping =~ /Daily/ ) {
             $args{'FUNCTION'} = "SUBSTR($alias.$field,1,10)";
         }

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


More information about the Rt-commit mailing list