Added a top bugs report to plans

This commit is contained in:
ghendricks%novell.com 2006-12-06 22:29:50 +00:00
Родитель d188f84460
Коммит 89185e6c2b
4 изменённых файлов: 80 добавлений и 0 удалений

Просмотреть файл

@ -34,6 +34,9 @@
[% IF form_action == 'tr_new_run.cgi' %]
<input type="hidden" name="case_status_id" value="2" />
[% END %]
[% IF type %]
<input type="hidden" name="type" value="[% type FILTER none %]" />
[% END %]
</p>
</form>

Просмотреть файл

@ -257,6 +257,7 @@
<a href="tr_plan_reports.cgi?plan_id=[% plan.id FILTER none %]&type=build_coverage">Build Coverage</a><br/>
<a href="tr_query.cgi?current_tab=plan&report=1">General Reports</a><br/>
[% IF plan.bugs %]
<a href="tr_plan_reports.cgi?plan_id=[% plan.id FILTER none %]&type=bugcounts">Top Bugs</a><br>
<a href="buglist.cgi?bug_id=[% plan.bug_list FILTER none %]">Bugs Found in this Plan</a><br>
[% END %]
[%##### Edit Plan #####%]

Просмотреть файл

@ -0,0 +1,40 @@
[%# 1.0@bugzilla.org %]
[%# 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 the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2001
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
#%]
[%# INTERFACE:
# ...
#%]
[% PROCESS global/header.html.tmpl %]
<table>
<tr>
<th>Test Cases</th>
<th>Bug</th>
</tr>
[% FOREACH row = bug_table %]
<tr class="[% loop.count % 2 == 1 ? "bz_row_odd" : "bz_row_even" %]">
<td align="center"><a href="tr_list_cases.cgi?bug_id=[% row.bug_id %]&plan_id=[% plan.id FILTER none %]">[% row.casecount FILTER html %]</a></td>
<td align="center">[% row.bug_id FILTER bug_link(row.bug_id) %]</td>
</tr>
[% END %]
</table>
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -29,6 +29,8 @@ use Bugzilla::Util;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Report;
require "globals.pl";
use vars qw($template $vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
@ -42,6 +44,8 @@ if ($type eq 'build_coverage'){
unless ($plan_id){
$vars->{'form_action'} = 'tr_plan_reports.cgi';
$vars->{'type'} = 'build_coverage';
print $cgi->header;
$template->process("testopia/plan/choose.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
@ -51,6 +55,7 @@ if ($type eq 'build_coverage'){
my $action = $cgi->param('action') || '';
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
my $report = {};
my %buildseen;
foreach my $case (@{$plan->test_cases}){
@ -86,6 +91,37 @@ if ($type eq 'build_coverage'){
|| ThrowTemplateError($template->error());
}
elsif ($type eq 'bugcounts'){
my $plan_id = trim(Bugzilla->cgi->param('plan_id') || '');
unless ($plan_id){
$vars->{'form_action'} = 'tr_plan_reports.cgi';
$vars->{'type'} = 'bugcounts';
print $cgi->header;
$template->process("testopia/plan/choose.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
validate_test_id($plan_id, 'plan');
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
my $dbh = Bugzilla->dbh;
my $ref = $dbh->selectall_arrayref(
"SELECT COUNT(bug_id) AS casecount, bug_id FROM test_case_bugs
INNER JOIN test_cases ON test_cases.case_id = test_case_bugs.case_id
INNER JOIN test_case_plans ON test_case_plans.case_id = test_cases.case_id
INNER JOIN test_plans ON test_case_plans.plan_id = test_plans.plan_id
WHERE test_plans.plan_id = ?
GROUP BY test_cases.case_id", {'Slice'=>{}}, $plan->id);
$vars->{'bug_table'} = $ref;
$vars->{'plan'} = $plan;
print $cgi->header;
$template->process("testopia/reports/bug-count.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
else{
$cgi->param('current_tab', 'plan');
$cgi->param('viewall', 1);