[Rt-commit] rt branch, 4.2/charts, updated. rt-4.1.8-481-g5d02d7c

Ruslan Zakirov ruz at bestpractical.com
Wed Jun 12 12:19:57 EDT 2013


The branch, 4.2/charts has been updated
       via  5d02d7c26a7e20b971ee90d88033d20af6461c16 (commit)
       via  30e79e8581638184b75e7f4245d353e466a4be3a (commit)
       via  d3a680a1930931ce6aa740711979ebf61ef1f726 (commit)
      from  479280da4a20713ca1f256f7de26472f42723bbd (commit)

Summary of changes:
 share/html/Elements/QueryString |  1 +
 share/html/Search/Chart         |  2 +-
 t/charts/basics.t               |  2 +-
 t/web/charting.t                | 28 ++++++++++++++++++----------
 4 files changed, 21 insertions(+), 12 deletions(-)

- Log -----------------------------------------------------------------
commit d3a680a1930931ce6aa740711979ebf61ef1f726
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Jun 12 20:10:08 2013 +0400

    get rid of undef warning in QueryString element

diff --git a/share/html/Elements/QueryString b/share/html/Elements/QueryString
index 0be8e35..f28c202 100644
--- a/share/html/Elements/QueryString
+++ b/share/html/Elements/QueryString
@@ -54,6 +54,7 @@ for my $key (sort keys %ARGS) {
     if( UNIVERSAL::isa( $value, 'ARRAY' ) ) {
         push @params,
             map $key ."=". $m->interp->apply_escapes( $_, 'u' ),
+            map defined $_? $_ : '',
                 @$value;
     } else {
         push @params, $key ."=". $m->interp->apply_escapes($value, 'u');

commit 30e79e8581638184b75e7f4245d353e466a4be3a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Jun 12 20:11:04 2013 +0400

    get rid of undef wanring when we sanitiza arguments

diff --git a/share/html/Search/Chart b/share/html/Search/Chart
index 7de786c..302ea48 100644
--- a/share/html/Search/Chart
+++ b/share/html/Search/Chart
@@ -62,7 +62,7 @@ my %font_config = RT->Config->Get('ChartFont');
 my $font = $font_config{ $session{CurrentUser}->UserObj->Lang || '' }
     || $font_config{'others'};
 
-s/\D//g for $Width, $Height;
+s/\D//g for grep defined, $Width, $Height;
 $Width  ||= 600;
 $Height ||= ($ChartStyle eq 'pie' ? $Width : 400);
 

commit 5d02d7c26a7e20b971ee90d88033d20af6461c16
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Jun 12 20:11:47 2013 +0400

    adjust charts test
    
    * structure of the table has been changed
    * "Tickets" was changed to "Ticket count"
    * default is group by status
    * catch warnings
    * mark one test as TODO, incorrect grouppings
      are skipped and code falls back to status, but UI
      doesn't indicate that chart is groupped by status

diff --git a/t/charts/basics.t b/t/charts/basics.t
index 0b5095d..7933498 100644
--- a/t/charts/basics.t
+++ b/t/charts/basics.t
@@ -33,7 +33,7 @@ use_ok 'RT::Report::Tickets';
         'thead' => [ {
                 'cells' => [
                     { 'value' => 'Status', 'type' => 'head' },
-                    { 'rowspan' => 1, 'value' => 'Tickets', 'type' => 'head' },
+                    { 'rowspan' => 1, 'value' => 'Ticket count', 'type' => 'head' },
                 ],
         } ],
        'tfoot' => [ {
diff --git a/t/web/charting.t b/t/web/charting.t
index 57551fe..8102dd2 100644
--- a/t/web/charting.t
+++ b/t/web/charting.t
@@ -5,7 +5,7 @@ BEGIN {
     require RT::Test;
 
     if (eval { require GD; 1 }) {
-        RT::Test->import(plan => 'no_plan');
+        RT::Test->import(tests => undef);
     }
     else {
         RT::Test->import(skip_all => 'GD required.');
@@ -35,8 +35,8 @@ ok( $m->login, "Logged in" );
 
 # Test that defaults work
 $m->get_ok( "/Search/Chart.html?Query=id>0" );
-$m->content_like(qr{<th[^>]*>Queue\s*</th>\s*<th[^>]*>Tickets\s*</th>}, "Grouped by queue");
-$m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*<a[^>]*>7</a>}, "Found results in table");
+$m->content_like(qr{<th[^>]*>Status\s*</th>\s*<th[^>]*>Ticket count\s*</th>}, "Grouped by status");
+$m->content_like(qr{new\s*</th>\s*<td[^>]*>\s*<a[^>]*>7</a>}, "Found results in table");
 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
 
 $m->get_ok( "/Search/Chart?Query=id>0" );
@@ -46,8 +46,8 @@ ok( length($m->content), "Has content" );
 
 # Group by Queue
 $m->get_ok( "/Search/Chart.html?Query=id>0&GroupBy=Queue" );
-$m->content_like(qr{<th[^>]*>Queue\s*</th>\s*<th[^>]*>Tickets\s*</th>}, "Grouped by queue");
-$m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*<a[^>]*>7</a>}, "Found results in table");
+$m->content_like(qr{<th[^>]*>Queue\s*</th>\s*<th[^>]*>Ticket count\s*</th>}, "Grouped by queue");
+$m->content_like(qr{General\s*</th>\s*<td[^>]*>\s*<a[^>]*>7</a>}, "Found results in table");
 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
 
 $m->get_ok( "/Search/Chart?Query=id>0&GroupBy=Queue" );
@@ -57,22 +57,30 @@ ok( length($m->content), "Has content" );
 
 # Group by Requestor email
 $m->get_ok( "/Search/Chart.html?Query=id>0&GroupBy=Requestor.EmailAddress" );
-$m->content_like(qr{<th[^>]*>Requestor\s+EmailAddress</th>\s*<th[^>]*>Tickets\s*</th>},
+$m->content_like(qr{<th[^>]*>Requestor\s+EmailAddress</th>\s*<th[^>]*>Ticket count\s*</th>},
                  "Grouped by requestor");
-$m->content_like(qr{root0\@localhost</a>\s*</td>\s*<td[^>]*>\s*<a[^>]*>3</a>}, "Found results in table");
+$m->content_like(qr{root0\@localhost\s*</th>\s*<td[^>]*>\s*<a[^>]*>3</a>}, "Found results in table");
 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
 
-$m->get_ok( "/Search/Chart?Query=id>0&GroupBy=Requestor.Email" );
+$m->get_ok( "/Search/Chart?Query=id>0&GroupBy=Requestor.EmailAddress" );
 is( $m->content_type, "image/png" );
 ok( length($m->content), "Has content" );
 
-
 # Group by Requestor phone -- which is bogus, and falls back to queue
+
 $m->get_ok( "/Search/Chart.html?Query=id>0&GroupBy=Requestor.Phone" );
-$m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*<a[^>]*>7</a>},
+$m->warning_like( qr{'Requestor\.Phone' is not a valid grouping for reports} );
+
+TODO: {
+    local $TODO = "UI should show that it's group by status";
+    $m->content_like(qr{new\s*</th>\s*<td[^>]*>\s*<a[^>]*>7</a>},
                  "Found queue results in table, as a default");
+}
 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
 
 $m->get_ok( "/Search/Chart?Query=id>0&GroupBy=Requestor.Phone" );
+$m->warning_like( qr{'Requestor\.Phone' is not a valid grouping for reports} );
 is( $m->content_type, "image/png" );
 ok( length($m->content), "Has content" );
+
+done_testing();

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


More information about the Rt-commit mailing list