[Rt-commit] rt branch, 4.2/date-time-improvements-in-charts, updated. rt-3.8.10-77-g1e3b8a5

Ruslan Zakirov ruz at bestpractical.com
Fri Jun 17 16:09:22 EDT 2011


The branch, 4.2/date-time-improvements-in-charts has been updated
       via  1e3b8a597813d122f680531efdf36d45f3c4bb1f (commit)
       via  0bc3a3775835cf170dabf51bd39f700395fb9228 (commit)
       via  0f5802590927b268f1990c448de50976f18da448 (commit)
       via  43b6377a8567b2fc7d3fd8984fcbfd5554df8bf8 (commit)
       via  1ad0c6c8a8306e7e2fbc4cbbf4061ee1ebadf2bd (commit)
      from  e820231f53aaf66e8f121d7b08a3b10c123c26d4 (commit)

Summary of changes:
 TODO.charts                              |   25 ++++++++++++++++----
 lib/RT/Report/Tickets/Entry.pm           |    2 +-
 share/html/Elements/QueryString          |    2 +-
 share/html/Search/Chart                  |   12 ++++++---
 share/html/Search/Chart.html             |   37 +++++++++++++----------------
 share/html/Search/Elements/Chart         |   14 ++++++-----
 share/html/Search/Elements/SelectGroupBy |   11 +++++---
 7 files changed, 62 insertions(+), 41 deletions(-)

- Log -----------------------------------------------------------------
commit 1ad0c6c8a8306e7e2fbc4cbbf4061ee1ebadf2bd
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jun 17 21:48:51 2011 +0400

    we actually should escape backslash, revert code back
    
    we're going to abstract this into methods in RT::SQL

diff --git a/lib/RT/Report/Tickets/Entry.pm b/lib/RT/Report/Tickets/Entry.pm
index 2bf20b6..7cd5e1a 100644
--- a/lib/RT/Report/Tickets/Entry.pm
+++ b/lib/RT/Report/Tickets/Entry.pm
@@ -118,7 +118,7 @@ sub Query {
             my $op = '=';
             if ( defined $value ) {
                 unless ( $value =~ /^\d+$/ ) {
-                    $value =~ s/'/\\'/g;
+                    $value =~ s/(['\\])/\\$1/g;
                     $value = "'$value'";
                 }
             }

commit 43b6377a8567b2fc7d3fd8984fcbfd5554df8bf8
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jun 17 21:50:03 2011 +0400

    comment situation with picturing only one function

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index 35faffb1..673865a 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -73,6 +73,7 @@ $PrimaryGroupBy = 'Queue'
 my %columns = $tix->SetupGroupings(
     Query => $Query,
     GroupBy => $PrimaryGroupBy,
+    # TODO: We don't picture more than one function at the moment
     Function => (grep defined && length, @ChartFunction)[0],
 );
 

commit 0f5802590927b268f1990c448de50976f18da448
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jun 17 23:19:41 2011 +0400

    MUST not sort arguments before joining with '&'
    
    we sorted keys earlier, so things that are independant from
    order are sorted and the rest is order sensitive.
    
    X => [qw(foo bar)] resulted in X=bar&X=foo that is
    very broken

diff --git a/share/html/Elements/QueryString b/share/html/Elements/QueryString
index a19b54e..3372b7c 100644
--- a/share/html/Elements/QueryString
+++ b/share/html/Elements/QueryString
@@ -60,5 +60,5 @@ for my $key (sort keys %ARGS) {
     }
 }
 
-return join '&', sort(@params);
+return join '&', @params;
 </%INIT>

commit 0bc3a3775835cf170dabf51bd39f700395fb9228
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Jun 17 23:25:40 2011 +0400

    support groupings by multiple fields
    
    at the moment tables are in one dimmension
    
    values in pictures are joined with ' - '

diff --git a/TODO.charts b/TODO.charts
index bd79628..c3e3cfe 100644
--- a/TODO.charts
+++ b/TODO.charts
@@ -2,8 +2,9 @@ move abuse protection code from callers to SetupGrouping
 
 protect Function in SetupGrouping from abuse
 
-upgrade for saved charts to switch from space separator
-to dot
+upgrade script for saved charts
+* switch from space separator to dot
+* switch from PrimaryGroupBy to GroupBy name
 
 it'd be nice if full day and month names worked in 
 "Created.DayOfWeek = 'Thu'" searches.
diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index 673865a..c3f8c0e 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -47,7 +47,7 @@
 %# END BPS TAGGED BLOCK }}}
 <%args>
 $Query => "id > 0"
-$PrimaryGroupBy => 'Queue'
+ at GroupBy => 'Queue'
 $ChartStyle => 'bars'
 @ChartFunction => 'COUNT'
 </%args>
@@ -67,12 +67,15 @@ if ($ChartStyle eq 'pie') {
 use RT::Report::Tickets;
 my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} );
 
-$PrimaryGroupBy = 'Queue'
-    unless $tix->IsValidGrouping( Query => $Query, GroupBy => $PrimaryGroupBy );
+foreach my $e ( splice @GroupBy ) {
+    next unless defined $e && length $e;
+    next unless $tix->IsValidGrouping( Query => $Query, GroupBy => $e );
+    push @GroupBy, $e;
+}
 
 my %columns = $tix->SetupGroupings(
     Query => $Query,
-    GroupBy => $PrimaryGroupBy,
+    GroupBy => \@GroupBy,
     # TODO: We don't picture more than one function at the moment
     Function => (grep defined && length, @ChartFunction)[0],
 );
diff --git a/share/html/Search/Chart.html b/share/html/Search/Chart.html
index 8f00726..665cbf5 100644
--- a/share/html/Search/Chart.html
+++ b/share/html/Search/Chart.html
@@ -46,7 +46,7 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <%args>
-$PrimaryGroupBy => 'Queue'
+ at GroupBy => 'Queue'
 $ChartStyle => 'bars'
 @ChartFunction => ('COUNT')
 $Description => undef
@@ -54,26 +54,11 @@ $Description => undef
 <%init>
 $ARGS{Query} ||= 'id > 0';
 
-# FIXME: should be factored with RT::Report::Tickets::Label :(
-my $PrimaryGroupByLabel;
-if ( $PrimaryGroupBy =~ /^(?:CF|CustomField)\.{(.*)}$/ ) {
-    my $cf = $1;
-    if ( $cf =~ /\D/ ) {
-        $PrimaryGroupByLabel = loc( "custom field '[_1]'", $cf );
-    } else {
-        my $obj = RT::CustomField->new( $session{'CurrentUser'} );
-        $obj->Load( $cf );
-        $PrimaryGroupByLabel = loc( "custom field '[_1]'", $obj->Name );
-    }
-} else {
-    $PrimaryGroupByLabel = loc( $PrimaryGroupBy );
-}
-
-my $title = loc( "Search results grouped by [_1]", $PrimaryGroupByLabel );
+my $title = loc( "Grouped search results");
 
 my $saved_search = $m->comp( '/Widgets/SavedSearch:new',
     SearchType   => 'Chart',
-    SearchFields => [qw(Query PrimaryGroupBy ChartStyle)] );
+    SearchFields => [qw(Query GroupBy ChartStyle ChartFunction)] );
 
 my @actions = $m->comp( '/Widgets/SavedSearch:process', args => \%ARGS, self => $saved_search );
 
@@ -91,9 +76,21 @@ my @actions = $m->comp( '/Widgets/SavedSearch:process', args => \%ARGS, self =>
 
 <&| /Widgets/TitleBox, title => loc('Properties') &>
 <% loc('Group by') %> <& Elements/SelectGroupBy,
-    Name => 'PrimaryGroupBy',
+    Name => 'GroupBy',
+    Query => $ARGS{Query},
+    Default => $GroupBy[0],
+&>
+<& Elements/SelectGroupBy,
+    Name => 'GroupBy',
+    Query => $ARGS{Query},
+    Default => $GroupBy[1],
+    ShowEmpty => 1,
+&>
+<& Elements/SelectGroupBy,
+    Name => 'GroupBy',
     Query => $ARGS{Query},
-    Default => $PrimaryGroupBy
+    Default => $GroupBy[2],
+    ShowEmpty => 1,
 &><br />
 
 <% loc('Count') %> <& Elements/SelectChartFunction, Default => $ChartFunction[0] &>
diff --git a/share/html/Search/Elements/Chart b/share/html/Search/Elements/Chart
index e03a921..0009dc4 100644
--- a/share/html/Search/Elements/Chart
+++ b/share/html/Search/Elements/Chart
@@ -47,26 +47,28 @@
 %# END BPS TAGGED BLOCK }}}
 <%args>
 $Query => "id > 0"
-$PrimaryGroupBy => 'Queue'
+ at GroupBy => 'Queue'
 $ChartStyle => 'bars'
 @ChartFunction => 'COUNT'
 </%args>
 <%init>
 use RT::Report::Tickets;
-$PrimaryGroupBy ||= 'Queue'; # make sure PrimaryGroupBy is not undef
 
 my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} );
 
-$PrimaryGroupBy = 'Queue'
-    unless $tix->IsValidGrouping( Query => $Query, GroupBy => $PrimaryGroupBy );
+foreach my $e ( splice @GroupBy ) {
+    next unless defined $e && length $e;
+    next unless $tix->IsValidGrouping( Query => $Query, GroupBy => $e );
+    push @GroupBy, $e;
+}
 
 my %columns = $tix->SetupGroupings(
     Query => $Query,
-    GroupBy => $PrimaryGroupBy,
+    GroupBy => \@GroupBy,
     Function => \@ChartFunction,
 );
 
-my $query_string = $m->comp('/Elements/QueryString', %ARGS);
+my $query_string = $m->comp('/Elements/QueryString', %ARGS, GroupBy => \@GroupBy );
 </%init>
 
 <% loc('Query:') %>&nbsp;<% $Query %><br />
diff --git a/share/html/Search/Elements/SelectGroupBy b/share/html/Search/Elements/SelectGroupBy
index fbf19ad..928de12 100644
--- a/share/html/Search/Elements/SelectGroupBy
+++ b/share/html/Search/Elements/SelectGroupBy
@@ -49,11 +49,14 @@
 $Name => 'GroupBy'
 $Default => 'Status'
 $Query   => ''
+$ShowEmpty => 0
 </%args>
-<select id="<% $Name %>" name="<% $Name %>">
-% while (@options) {
-% my ($text, $value) = (shift @options, shift @options);
-<option value="<% $value %>" <% $value eq $Default ? 'selected="selected"' : '' |n%>><% loc($text) %></option>
+<select name="<% $Name %>">
+% if ( $ShowEmpty ) {
+<option value="">&nbsp;</option>
+% }
+% while ( my ($text, $value) = splice @options, 0, 2 ) {
+<option value="<% $value %>" <% $value eq ($Default||'') ? 'selected="selected"' : '' |n %>><% loc($text) %></option>
 % }
 </select>
 <%init>

commit 1e3b8a597813d122f680531efdf36d45f3c4bb1f
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Sat Jun 18 00:08:20 2011 +0400

    update todo for charts

diff --git a/TODO.charts b/TODO.charts
index c3e3cfe..541caa5 100644
--- a/TODO.charts
+++ b/TODO.charts
@@ -12,10 +12,24 @@ it'd be nice if full day and month names worked in
 support more than one calculated function in diagrams,
 at least in bars
 
-support multiple groupings
+support putting grouppings as columns of the table
+support horizontal totals when there are gropings as columns
 
-  support putting grouppings as columns of the table
+support links with partial queries in tables, for example
+table:
 
-  support horizontal totals when there are gropings as columns
+                          Owner
+    Queue      Status     Nobody [3]
+    General[1] open[2]    10[4]
 
+    [1] - $query AND Queue = 'General'
+    [2] - [1] AND Status = 'open'
+    [3] - $query AND Owner = 'Nobody'
+    [4] - [2] AND [3]
 
+
+On my machine Created-LastUpdated interval is 1 second
+for newely created tickets. It's either bug or just
+operation is long enough to span over two seconds. It
+would be nice to ignore difference up to 3 seconds or
+something like that.

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


More information about the Rt-commit mailing list