From 66ab1ddafc69bf720f861e65db43d455ec9ec368 Mon Sep 17 00:00:00 2001 From: "ghendricks%novell.com" Date: Wed, 30 Apr 2008 17:13:24 +0000 Subject: [PATCH] Fix totals in CSV of reports Fix lookup by product (object) in the webservice --- .../testopia/Bugzilla/WebService/Testopia/Build.pm | 2 +- .../Bugzilla/WebService/Testopia/Environment.pm | 2 +- .../testopia/Bugzilla/WebService/Testopia/Product.pm | 6 +++--- .../en/default/testopia/reports/report.csv.tmpl | 12 +++--------- .../testopia/testopia/contrib/drivers/perl/client.pl | 9 ++++++--- webtools/testopia/tr_csv2xml.pl | 3 +-- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm b/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm index fe183ad2994..1d6b14c0038 100644 --- a/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm +++ b/webtools/testopia/Bugzilla/WebService/Testopia/Build.pm @@ -54,7 +54,7 @@ sub check_build { Bugzilla->login(LOGIN_REQUIRED); if (ref $product){ - $product = $product; + $product = Bugzilla::Testopia::Product->new($product->{id}); } elsif ($product =~ /^\d+$/){ $product = Bugzilla::Testopia::Product->new($product); diff --git a/webtools/testopia/Bugzilla/WebService/Testopia/Environment.pm b/webtools/testopia/Bugzilla/WebService/Testopia/Environment.pm index dad1e27b639..46ddbd0188d 100644 --- a/webtools/testopia/Bugzilla/WebService/Testopia/Environment.pm +++ b/webtools/testopia/Bugzilla/WebService/Testopia/Environment.pm @@ -53,7 +53,7 @@ sub check_environment { Bugzilla->login(LOGIN_REQUIRED); if (ref $product){ - $product = $product; + $product = Bugzilla::Testopia::Product->new($product->{id}); } elsif ($product =~ /^\d+$/){ $product = Bugzilla::Testopia::Product->new($product); diff --git a/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm b/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm index 7698614c5b5..e537e40ad9b 100644 --- a/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm +++ b/webtools/testopia/Bugzilla/WebService/Testopia/Product.pm @@ -34,7 +34,7 @@ sub _validate { Bugzilla->login(LOGIN_REQUIRED); if (ref $product){ - $product = $product; + $product = Bugzilla::Testopia::Product->new($product->{id}); } elsif ($product =~ /^\d+$/){ $product = Bugzilla::Testopia::Product->new($product); @@ -81,7 +81,7 @@ sub check_category { Bugzilla->login(LOGIN_REQUIRED); if (ref $product){ - $product = $product; + $product = Bugzilla::Testopia::Product->new($product->{id}); } elsif ($product =~ /^\d+$/){ $product = Bugzilla::Testopia::Product->new($product); @@ -103,7 +103,7 @@ sub check_component { Bugzilla->login(LOGIN_REQUIRED); if (ref $product){ - $product = $product; + $product = Bugzilla::Testopia::Product->new($product->{id}); } elsif ($product =~ /^\d+$/){ $product = Bugzilla::Testopia::Product->new($product); diff --git a/webtools/testopia/template/en/default/testopia/reports/report.csv.tmpl b/webtools/testopia/template/en/default/testopia/reports/report.csv.tmpl index e694ed0c399..0297f87a1aa 100644 --- a/webtools/testopia/template/en/default/testopia/reports/report.csv.tmpl +++ b/webtools/testopia/template/en/default/testopia/reports/report.csv.tmpl @@ -58,15 +58,9 @@ [% FOREACH row = report.row_names %] [% row_total = 0 %] - [% IF report.row_field == 'bug_status' %] - [% status_descs.$row FILTER csv -%] - [% ELSIF report.row_field == 'resolution' %] - [% resolution_descs.$row FILTER csv -%] - [% ELSE %] - [% row FILTER csv -%] - [% END %] + [% row FILTER csv -%] [% FOREACH col = report.col_names %] - [% row_total = row_total + data.$tbl.$col.$row %] + [% row_total = row_total + report.data.$tbl.$col.$row %] [% colsepchar %] [% IF report.data.$tbl AND report.data.$tbl.$col AND report.data.$tbl.$col.$row %] [% col_totals.$col = col_totals.$col + report.data.$tbl.$col.$row %] @@ -81,7 +75,7 @@ [% grand_total = grand_total + row_total %] [% END %] [% 'Total' FILTER csv %] - [% FOREACH col = col_names %] + [% FOREACH col = report.col_names %] [% NEXT IF col == "" %] [% colsepchar %] [% col_totals.$col %] diff --git a/webtools/testopia/testopia/contrib/drivers/perl/client.pl b/webtools/testopia/testopia/contrib/drivers/perl/client.pl index 52cdcb3bce5..cf4a2d5cd1d 100644 --- a/webtools/testopia/testopia/contrib/drivers/perl/client.pl +++ b/webtools/testopia/testopia/contrib/drivers/perl/client.pl @@ -58,6 +58,9 @@ use HTTP::Cookies; use Carp; use Data::Dumper; +use lib '../../../..'; +use Bugzilla::Testopia::Product; + my $help; my $Bugzilla_uri; my $Bugzilla_login; @@ -141,13 +144,13 @@ if (defined($Bugzilla_login)) { } } - ##################### ### Build Methods ### ##################### #$soapresult = $proxy->call('Build.check_build', 'Linux', 2); #$soapresult = $proxy->call('Build.check_build', 'Linux', 'Bugzilla'); +#$soapresult = $proxy->call('Build.check_build', 'Linux', Bugzilla::Testopia::Product->new(2)); #$soapresult = $proxy->call('Build.create', {name=>'Build '. time(), product_id=>2, isactive=>0, description=> 'API Test Build - IGNORE'}); #$soapresult = $proxy->call('Build.get', 1140); #$soapresult = $proxy->call('Build.update', 1140, { description=>'This is a description', milestone=>'3.0', isactive=>0}); @@ -155,9 +158,9 @@ if (defined($Bugzilla_login)) { ########################### ### Environment Methods ### ########################### - #$soapresult = $proxy->call('Environment.check_environment', 'Linux', 2); #$soapresult = $proxy->call('Environment.check_environment', 'Linux', 'Bugzilla'); +#$soapresult = $proxy->call('Environment.check_environment', 'Linux', Bugzilla::Testopia::Product->new(2)); #$soapresult = $proxy->call('Environment.create', {product_id=>2, name=>'Environment '.time() , isactive=>1}); #$soapresult = $proxy->call('Environment.get', 1018); #$soapresult = $proxy->call('Environment.list', {environment_id=>330}); @@ -217,7 +220,7 @@ if (defined($Bugzilla_login)) { #$soapresult = $proxy->call('TestCase.store_text', 278, 'vrb@novell.com', 'FOO', 'FISH', 'FIGHT', 'FUN'); #$soapresult = $proxy->call('TestCase.unlink_plan', 278, 78); #$soapresult = $proxy->call('TestCase.update', 278,{priority_id => 'P2 - High', case_status_id=>3 ,summary=>'This was Entering bugs', category_id => '142'}); -$soapresult = $proxy->call('TestCase.update',435838 ,{ summary => 'API TEST', category_id => '1666'}); +#$soapresult = $proxy->call('TestCase.update',435838 ,{ summary => 'API TEST', category_id => '1666'}); ########################### diff --git a/webtools/testopia/tr_csv2xml.pl b/webtools/testopia/tr_csv2xml.pl index 8834801b06d..e4d8c85eaef 100644 --- a/webtools/testopia/tr_csv2xml.pl +++ b/webtools/testopia/tr_csv2xml.pl @@ -404,8 +404,7 @@ sub remove_field_list # if ( $tcdb ) { - my @args = ( "-u -o " . $work_filename . " " . $work_filename ); - system("sort", @args) == 0 or error("Could not sort $work_filename"); + system("sort -u -o " . $work_filename . " " . $work_filename) == 0 or error("Could not sort $work_filename"); } return $field_list;