From 5ed2cd6ba4220e6c201f06cce124cd0a99e3f5b6 Mon Sep 17 00:00:00 2001 From: "ccooper%deadsquid.com" Date: Wed, 13 Sep 2006 17:45:50 +0000 Subject: [PATCH] b=351741 - added testgroup popularity report query --- webtools/litmus/aggregate_results.cgi | 83 +++++++++++++++++++ .../en/default/global/litmus_footer.tmpl | 2 +- .../en/default/global/selects.none.tmpl | 2 +- .../default/reporting/aggregate_results.tmpl | 45 ++++++++++ .../reporting/aggregate_results_table.tmpl | 54 ++++++++++++ 5 files changed, 184 insertions(+), 2 deletions(-) create mode 100755 webtools/litmus/aggregate_results.cgi create mode 100644 webtools/litmus/templates/en/default/reporting/aggregate_results.tmpl create mode 100644 webtools/litmus/templates/en/default/reporting/aggregate_results_table.tmpl diff --git a/webtools/litmus/aggregate_results.cgi b/webtools/litmus/aggregate_results.cgi new file mode 100755 index 000000000000..0900bc247815 --- /dev/null +++ b/webtools/litmus/aggregate_results.cgi @@ -0,0 +1,83 @@ +#!/usr/bin/perl -w +# -*- mode: cperl; c-basic-offset: 8; indent-tabs-mode: nil; -*- + +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Litmus. +# +# The Initial Developer of the Original Code is +# the Mozilla Corporation. +# Portions created by the Initial Developer are Copyright (C) 2006 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Chris Cooper +# Zach Lipton +# +# ***** END LICENSE BLOCK ***** + +use strict; +$|++; + +use Litmus; +use Litmus::Auth; +use Litmus::Error; +use Litmus::DBI; + +use CGI; +use Time::Piece::MySQL; + +Litmus->init(); +my $c = Litmus->cgi(); +print $c->header(); + +my $template = "reporting/aggregate_results.tmpl"; +my $title = "Test Results Submitted by Testgroup"; + +my $results; +my $dbh = Litmus::DBI->db_Main(); +my $sql = "SELECT tg.name AS testgroup_name,pr.name AS product_name,b.name AS branch_name,count(tr.testresult_id) AS num_results + FROM testgroups tg, products pr, branches b, testgroup_branches tgb, subgroup_testgroups sgtg, testcase_subgroups tcsg, testcases tc, test_results tr + WHERE tg.testgroup_id=tgb.testgroup_id AND tgb.branch_id=b.branch_id AND tg.product_id=pr.product_id AND tg.enabled=1 AND tg.testgroup_id=sgtg.testgroup_id AND sgtg.subgroup_id=tcsg.subgroup_id AND tcsg.testcase_id=tc.testcase_id AND tc.testcase_id=tr.testcase_id AND tc.enabled=1 AND tr.branch_id=tgb.branch_id AND tc.product_id=tg.product_id + GROUP BY tg.name,pr.name,b.name + ORDER BY pr.name, b.name"; +my $sth = $dbh->prepare($sql); +$sth->execute(); +while (my $data = $sth->fetchrow_hashref) { + push @$results, $data; +} +$sth->finish(); + +my $vars = { + title => $title, + status => $c->param('status'), + }; + +# Only include results if we have them. +if ($results and scalar @$results > 0) { + $vars->{results} = $results; +} + +$vars->{"defaultemail"} = Litmus::Auth::getCookie(); + +Litmus->template()->process($template, $vars) || + internalError(Litmus->template()->error()); + +exit 0; + + + + + + diff --git a/webtools/litmus/templates/en/default/global/litmus_footer.tmpl b/webtools/litmus/templates/en/default/global/litmus_footer.tmpl index c4f4d49c7177..c2875659da0a 100644 --- a/webtools/litmus/templates/en/default/global/litmus_footer.tmpl +++ b/webtools/litmus/templates/en/default/global/litmus_footer.tmpl @@ -26,7 +26,7 @@ #%] diff --git a/webtools/litmus/templates/en/default/global/selects.none.tmpl b/webtools/litmus/templates/en/default/global/selects.none.tmpl index eed0da7a994a..38909608a68b 100755 --- a/webtools/litmus/templates/en/default/global/selects.none.tmpl +++ b/webtools/litmus/templates/en/default/global/selects.none.tmpl @@ -91,7 +91,7 @@ type="hidden" value="[%valuelist FILTER html%]"> [% END %] - [% END %] diff --git a/webtools/litmus/templates/en/default/reporting/aggregate_results.tmpl b/webtools/litmus/templates/en/default/reporting/aggregate_results.tmpl new file mode 100644 index 000000000000..b36c18466fb3 --- /dev/null +++ b/webtools/litmus/templates/en/default/reporting/aggregate_results.tmpl @@ -0,0 +1,45 @@ +[%# ***** BEGIN LICENSE BLOCK ***** + # Version: MPL 1.1 + # + # The contents of this file are subject to the Mozilla Public License Version + # 1.1 (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS IS" basis, + # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + # for the specific language governing rights and limitations under the + # License. + # + # The Original Code is Litmus. + # + # The Initial Developer of the Original Code is + # The Mozilla Corporation. + # Portions created by the Initial Developer are Copyright (C) 2006 + # the Initial Developer. All Rights Reserved. + # + # Contributor(s): + # Chris Cooper + # Zach Lipton + # + # ***** END LICENSE BLOCK ***** +#%] + +[% INCLUDE global/html_header.tmpl includeselects=1 %] +[% INCLUDE global/litmus_header.tmpl %] + +
+ +[% INCLUDE sidebar/sidebar.tmpl %] + +
+ +

[% title | html %]

+ [% INCLUDE reporting/aggregate_results_table.tmpl %] + +
+ +
+ +[% INCLUDE global/litmus_footer.tmpl %] +[% INCLUDE global/html_footer.tmpl %] diff --git a/webtools/litmus/templates/en/default/reporting/aggregate_results_table.tmpl b/webtools/litmus/templates/en/default/reporting/aggregate_results_table.tmpl new file mode 100644 index 000000000000..7e8e8230f74c --- /dev/null +++ b/webtools/litmus/templates/en/default/reporting/aggregate_results_table.tmpl @@ -0,0 +1,54 @@ +[%# ***** BEGIN LICENSE BLOCK ***** + # Version: MPL 1.1 + # + # The contents of this file are subject to the Mozilla Public License Version + # 1.1 (the "License"); you may not use this file except in compliance with + # the License. You may obtain a copy of the License at + # http://www.mozilla.org/MPL/ + # + # Software distributed under the License is distributed on an "AS IS" basis, + # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + # for the specific language governing rights and limitations under the + # License. + # + # The Original Code is Litmus. + # + # The Initial Developer of the Original Code is + # The Mozilla Corporation. + # Portions created by the Initial Developer are Copyright (C) 2006 + # the Initial Developer. All Rights Reserved. + # + # Contributor(s): + # Chris Cooper + # Zach Lipton + # + # ***** END LICENSE BLOCK ***** +#%] + + + + + + + + + + +[% IF results %] + [% FOREACH result=results %] + + + + + + + [% END %] +[% ELSE %] + + + +[% END %] + +
ProductBranchTestgroup# Results
[% result.product_name %][% result.branch_name | html %] +[% result.testgroup_name | html %][% result.num_results | html %]
No test results match the search criteria.
+