- add trusted coverage display
This commit is contained in:
ccooper%deadsquid.com 2006-08-22 23:02:43 +00:00
Родитель 24ee7b3b4a
Коммит 5a8e13c498
7 изменённых файлов: 167 добавлений и 56 удалений

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

@ -48,42 +48,60 @@ Litmus::DB::Subgroup->column_alias("subgroup_id", "subgroupid");
Litmus::DB::Subgroup->has_a(product => "Litmus::DB::Product");
__PACKAGE__->set_sql(EnabledByTestgroup => qq{
SELECT sg.*
FROM subgroups sg, subgroup_testgroups sgtg
WHERE sgtg.testgroup_id=? AND sgtg.subgroup_id=sg.subgroup_id AND sg.enabled=1
ORDER BY sgtg.sort_order ASC
SELECT sg.*
FROM subgroups sg, subgroup_testgroups sgtg
WHERE
sgtg.testgroup_id=? AND
sgtg.subgroup_id=sg.subgroup_id AND
sg.enabled=1
ORDER BY sgtg.sort_order ASC
});
__PACKAGE__->set_sql(ByTestgroup => qq{
SELECT sg.*
FROM subgroups sg, subgroup_testgroups sgtg
WHERE sgtg.testgroup_id=? AND sgtg.subgroup_id=sg.subgroup_id
ORDER BY sgtg.sort_order ASC
SELECT sg.*
FROM subgroups sg, subgroup_testgroups sgtg
WHERE
sgtg.testgroup_id=? AND
sgtg.subgroup_id=sg.subgroup_id
ORDER BY sgtg.sort_order ASC
});
__PACKAGE__->set_sql(NumCommunityEnabledTestcases => qq{
SELECT count(tc.testcase_id) as num_testcases
FROM testcases tc, testcase_subgroups tcsg
WHERE tcsg.subgroup_id=? AND tcsg.testcase_id=tc.testcase_id AND tc.enabled=1 AND tc.community_enabled=1
SELECT count(tc.testcase_id) AS num_testcases
FROM testcases tc, testcase_subgroups tcsg
WHERE
tcsg.subgroup_id=? AND
tcsg.testcase_id=tc.testcase_id AND
tc.enabled=1 AND
tc.community_enabled=1
});
__PACKAGE__->set_sql(NumEnabledTestcases => qq{
SELECT count(tc.testcase_id) as num_testcases
FROM testcases tc, testcase_subgroups tcsg
WHERE tcsg.subgroup_id=? AND tcsg.testcase_id=tc.testcase_id AND tc.enabled=1
SELECT count(tc.testcase_id) AS num_testcases
FROM testcases tc, testcase_subgroups tcsg
WHERE
tcsg.subgroup_id=? AND
tcsg.testcase_id=tc.testcase_id AND
tc.enabled=1
});
__PACKAGE__->set_sql(EnabledByTestcase => qq{
SELECT sg.*
FROM subgroups sg, testcase_subgroups tcsg
WHERE tcsg.testcase_id=? AND tcsg.subgroup_id=sg.subgroup_id AND sg.enabled=1
ORDER by sg.name ASC
SELECT sg.*
FROM subgroups sg, testcase_subgroups tcsg
WHERE
tcsg.testcase_id=? AND
tcsg.subgroup_id=sg.subgroup_id AND
sg.enabled=1
ORDER by sg.name ASC
});
__PACKAGE__->set_sql(ByTestcase => qq{
SELECT sg.*
FROM subgroups sg, testcase_subgroups tcsg
WHERE tcsg.testcase_id=? AND tcsg.subgroup_id=sg.subgroup_id
ORDER by sg.name ASC
SELECT sg.*
FROM subgroups sg, testcase_subgroups tcsg
WHERE
tcsg.testcase_id=? AND
tcsg.subgroup_id=sg.subgroup_id
ORDER by sg.name ASC
});
#########################################################################
@ -94,6 +112,7 @@ sub coverage() {
my $locale = shift;
my $community_only = shift;
my $user = shift;
my $trusted = shift;
my $sql = "SELECT COUNT(t.testcase_id) FROM testcase_subgroups tsg, testcases t WHERE tsg.subgroup_id=? AND tsg.testcase_id=t.testcase_id AND t.enabled=1";
if ($community_only) {
@ -111,16 +130,22 @@ sub coverage() {
if (!$num_testcases or
$num_testcases == 0) { return "N/A" }
$sql = "SELECT t.testcase_id, count(tr.testresult_id) AS num_results
FROM testcase_subgroups tsg JOIN testcases t ON (tsg.testcase_id=t.testcase_id) LEFT JOIN test_results tr ON (tr.testcase_id=t.testcase_id) JOIN opsyses o ON (tr.opsys_id=o.opsys_id)
WHERE tsg.subgroup_id=? AND tr.build_id=? AND tr.locale_abbrev=? AND o.platform_id=?";
FROM testcase_subgroups tsg JOIN testcases t ON (tsg.testcase_id=t.testcase_id) LEFT JOIN test_results tr ON (tr.testcase_id=t.testcase_id) JOIN opsyses o ON (tr.opsys_id=o.opsys_id)";
if ($trusted) {
$sql .= ", users u";
}
$sql .= " WHERE tsg.subgroup_id=? AND tr.build_id=? AND tr.locale_abbrev=? AND o.platform_id=?";
if ($community_only) {
$sql .= " AND t.community_enabled=1";
}
if ($user) {
$sql .= " AND tr.user_id=" . $user->{'user_id'};
}
if ($trusted) {
$sql .= " AND tr.user_id=u.user_id AND u.is_admin=1";
}
$sql .= " GROUP BY tr.testcase_id";
@ -152,6 +177,24 @@ sub coverage() {
return sprintf("%d",$result);
}
#########################################################################
sub getNumEnabledTestcases {
my $self = shift;
my ($count) = $self->search_NumEnabledTestcases($self->subgroup_id);
return $count->{'num_testcases'};
}
#########################################################################
sub getNumCommunityEnabledTestcases {
my $self = shift;
my ($count) = $self->search_NumCommunityEnabledTestcases($self->subgroup_id);
return $count->{'num_testcases'};
}
#########################################################################
sub clone() {
my $self = shift;

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

@ -61,12 +61,7 @@ Litmus::DB::Testcase->has_a("format" => "Litmus::DB::Format");
Litmus::DB::Testcase->has_a("author" => "Litmus::DB::User");
Litmus::DB::Testcase->has_a("product" => "Litmus::DB::Product");
__PACKAGE__->set_sql(EnabledBySubgroup => qq{
SELECT t.*
FROM testcases t, testcase_subgroups tsg
WHERE tsg.subgroup_id=? AND tsg.testcase_id=t.testcase_id AND t.enabled=1
ORDER BY tsg.sort_order ASC
});
Litmus::DB::Testcase->has_many(test_results => "Litmus::DB::Testresult", {order_by => 'submission_time DESC'});
__PACKAGE__->set_sql(BySubgroup => qq{
SELECT t.*
@ -87,17 +82,26 @@ WHERE
ORDER BY tsg.sort_order ASC
});
__PACKAGE__->set_sql(CommunityEnabledBySubgroup => qq{
SELECT t.*
FROM testcases t, testcase_subgroups tsg
WHERE tsg.subgroup_id=? AND tsg.testcase_id=t.testcase_id AND t.enabled=1 AND t.community_enabled=1
ORDER BY tsg.sort_order ASC, t.testcase_id ASC
__PACKAGE__->set_sql(EnabledBySubgroup => qq{
SELECT t.*
FROM testcases t, testcase_subgroups tsg
WHERE
tsg.subgroup_id=? AND
tsg.testcase_id=t.testcase_id AND
t.enabled=1
ORDER BY tsg.sort_order ASC
});
Litmus::DB::Testcase->has_many(test_results => "Litmus::DB::Testresult", {order_by => 'submission_time DESC'});
Litmus::DB::Testcase->has_many(subgroups =>
["Litmus::DB::TestcaseSubgroup" => 'subgroup']);
__PACKAGE__->set_sql(CommunityEnabledBySubgroup => qq{
SELECT t.*
FROM testcases t, testcase_subgroups tsg
WHERE
tsg.subgroup_id=? AND
tsg.testcase_id=t.testcase_id AND
t.enabled=1 AND
t.community_enabled=1
ORDER BY tsg.sort_order ASC, t.testcase_id ASC
});
#########################################################################
# is_completed($$$$$)
@ -112,9 +116,17 @@ sub is_completed {
my $build_id = shift;
my $locale = shift;
my $user = shift; # optional
my $trusted = shift; # optional
my @results;
if ($user) {
if ($trusted) {
@results = Litmus::DB::Testresult->search_CompletedByTrusted(
$self->{'testcase_id'},
$build_id,
$locale->{'abbrev'},
$platform->{'platform_id'},
);
} elsif ($user) {
@results = Litmus::DB::Testresult->search_CompletedByUser(
$self->{'testcase_id'},
$build_id,

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

@ -88,6 +88,7 @@ sub coverage {
my $locale = shift;
my $community_only = shift;
my $user = shift;
my $trusted = shift;
my $percent_completed = 0;
@ -100,6 +101,7 @@ sub coverage {
$locale,
$community_only,
$user,
$trusted,
);
if ($subgroup_percent eq "N/A") {
$num_empty_subgroups++;

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

@ -48,6 +48,7 @@ Litmus::DB::Testresult->columns(All => qw/testresult_id testcase_id last_updated
Litmus::DB::Testresult->column_alias("testcase_id", "testcase");
Litmus::DB::Testresult->column_alias("submission_time", "timestamp");
Litmus::DB::Testresult->column_alias("submission_time", "created");
Litmus::DB::Testresult->column_alias("user_id", "user");
Litmus::DB::Testresult->column_alias("opsys_id", "opsys");
Litmus::DB::Testresult->column_alias("branch_id", "branch");
@ -119,6 +120,19 @@ Litmus::DB::Testresult->set_sql(CompletedByUser => qq{
ORDER BY tr.submission_time DESC
});
Litmus::DB::Testresult->set_sql(CompletedByTrusted => qq{
SELECT tr.*
FROM test_results tr, opsyses o, users u
WHERE tr.testcase_id=? AND
tr.build_id=? AND
tr.locale_abbrev=? AND
tr.opsys_id=o.opsys_id AND
o.platform_id=? AND
tr.user_id=u.user_id AND
u.is_admin=1
ORDER BY tr.submission_time DESC
});
#########################################################################
# for historical reasons, note() is a shorthand way of saying "the text of
# the first comment on this result if that comment was submitted by the

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

@ -1060,6 +1060,9 @@ ol {
.completegroup {
background-color: #999999;
}
.trustedcompletegroup {
background-color: #66CC66;
}
.confirmedgroup {
background-color: #666666;
}

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

@ -71,6 +71,9 @@ Select Testing Group
<th>Name</th>
<th>Personal Testing Coverage</th>
<th>Community Testing Coverage</th>
[% IF show_admin %]
<th>Trusted Coverage</th>
[% END %]
</tr>
[% IF defaultgroup.testgroup_id=="" %]
@ -82,7 +85,8 @@ Select Testing Group
[% community_completed = curgroup.coverage(sysconfig.platform, sysconfig.build_id, sysconfig.locale, 0) %]
[% personal_completed = curgroup.coverage(sysconfig.platform, sysconfig.build_id, sysconfig.locale, 0, user) %]
[% trusted_completed = curgroup.coverage(sysconfig.platform, sysconfig.build_id, sysconfig.locale, 0, 0, 1) %]
[% IF community_completed == 100 OR completed == 'N/A' %]
[% groupstyle = 'completegroup' %]
[% ELSE %]
@ -93,6 +97,12 @@ Select Testing Group
[% END %]
[% END %]
[% IF show_admin %]
[% IF trusted_completed == 100 %]
[% groupstyle = 'trustedcompletegroup' %]
[% END %]
[% END %]
<tr class="[% groupstyle | none %]">
[% IF personal_completed != 100 AND
@ -110,6 +120,9 @@ Select Testing Group
[% curgroup.name FILTER html %]</td>
<td align="center">[% personal_completed FILTER html %][% IF personal_completed != 'N/A' %]%[% END %]</td>
<td align="center">[% community_completed FILTER html %][% IF community_completed != 'N/A' %]%[% END %]</td>
[% IF show_admin %]
<td align="center">[% trusted_completed FILTER html %][% IF trusted_completed != 'N/A' %]%[% END %]</td>
[% END %]
</tr>
[% END %]
@ -134,13 +147,19 @@ Select Subgroup
</div>
<div class="section-content">
<p>
[% headerrow = '<tr><th>Name</th><th>Number of Tests</th><th>Personal Testing Coverage</th><th>Community Testing Coverage</th></tr>' %]
[% IF show_admin %]
[% headerrow = '<tr><th>Name</th><th>Number of Tests</th><th>Personal Testing Coverage</th><th>Community Testing Coverage</th><th>Trusted Coverage</th></tr>' %]
[% colspan = 5 %]
[% ELSE %]
[% headerrow = '<tr><th>Name</th><th>Number of Tests</th><th>Personal Testing Coverage</th><th>Community Testing Coverage</th></tr>' %]
[% colspan = 4 %]
[% END %]
<div id="divsubgroup_null" style="visibility: visible;">
<table class="run-tests">
[% headerrow | none %]
<tr>
<td colspan="4" class="no-results">
<td colspan="[% colspan %]" class="no-results">
Please select a testing group with testcases, or that has not yet been tested in its entirety.
</td>
</tr>
@ -160,29 +179,40 @@ Please select a testing group with testcases, or that has not yet been tested in
[% community_completed = cursubgroup.coverage(sysconfig.platform, sysconfig.build_id, sysconfig.locale, 0) %]
[% personal_completed = cursubgroup.coverage(sysconfig.platform, sysconfig.build_id, sysconfig.locale, 0, user) %]
[% trusted_completed = cursubgroup.coverage(sysconfig.platform, sysconfig.build_id, sysconfig.locale, 0, 0, 1) %]
[% IF community_completed == 100 OR completed == 'N/A' %]
[% groupstyle = 'completegroup' %]
[% groupstyle = 'completegroup' %]
[% ELSE %]
[% IF not (loop.count % 2) %]
[% groupstyle = 'even' %]
[% ELSE %]
[% groupstyle = 'odd' %]
[% END %]
[% IF not (loop.count % 2) %]
[% groupstyle = 'even' %]
[% ELSE %]
[% groupstyle = 'odd' %]
[% END %]
[% END %]
[% IF show_admin %]
[% IF trusted_completed == 100 %]
[% groupstyle = 'trustedcompletegroup' %]
[% END %]
[% END %]
[% IF show_admin %]
[% counttests = cursubgroup.search_NumCommunityEnabledTestcases(cursubgroup.subgroup_id) %]
[% counttests = cursubgroup.getNumEnabledTestcases() %]
[% ELSE %]
[% counttests = cursubgroup.search_NumCommunityEnabledTestcases(cursubgroup.subgroup_id) %]
[% counttests = cursubgroup.getNumCommunityEnabledTestcases() %]
[% END %]
<tr class="[% groupstyle | none %]">
<td align="left"><input [% IF ! counttests.num_testcases %]disabled [% ELSIF select_first_avail_subgroup==1 %][% select_first_avail_subgroup=0 %]checked [% END %]type="radio" name="subgroup_[% curgroup FILTER html %]"
<td align="left"><input [% IF ! counttests %]disabled [% ELSIF select_first_avail_subgroup==1 %][% select_first_avail_subgroup=0 %]checked [% END %]type="radio" name="subgroup_[% curgroup FILTER html %]"
value="[% cursubgroup.id FILTER html %]">
[% cursubgroup.name FILTER html %]</input></td>
<td align="center">[% IF ! counttests.num_testcases %] 0 [% ELSE %] [% counttests.num_testcases %] [% END %]</td>
<td align="center">[% IF ! counttests %] 0 [% ELSE %] [% counttests %] [% END %]</td>
<td align="center">[% personal_completed FILTER html %][% IF personal_completed != 'N/A' %]%[% END %]</td>
<td align="center">[% community_completed FILTER html %][% IF community_completed != 'N/A' %]%[% END %]</td>
[% IF show_admin %]
<td align="center">[% trusted_completed FILTER html %][% IF trusted_completed != 'N/A' %]%[% END %]</td>
[% END %]
</tr>
[% END %]
</table>

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

@ -86,14 +86,21 @@
<!-- Test [% i %] Start -->
[% results=curtest.is_completed(sysconfig.platform,sysconfig.build_id,sysconfig.locale,defaultemail) %]
[% IF show_admin %]
[% results=curtest.is_completed(sysconfig.platform,sysconfig.build_id,sysconfig.locale,defaultemail,show_admin) %]
[% already_run_text = 'A trusted tester has already submitted a result for this testcase.' %]
[% ELSE %]
[% results=curtest.is_completed(sysconfig.platform,sysconfig.build_id,sysconfig.locale,defaultemail) %]
[% already_run_text = 'You have already submitted a result for this testcase.' %]
[% END %]
[% IF results %][% testcase_class="testcase-completed" %][% ELSE %][% testcase_class="testcase" %][% END %]
<div class="[% testcase_class %]" id="t[% i %]">
<div class="testcase-head">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="l"><a name="test_[% i %]" onclick="allStretch.toggle('t[% i %]-content');">[% loop.count %]: [% curtest.summary | html %]&nbsp;&raquo;</a></td>
<td class="r">[% IF results %]<a title="You have already submitted a result for this testcase." target="test_results" href="single_result.cgi?id=[% results.0.testresult_id %]"><img align="absmiddle" src="images/confirm.png" border="0" /></a>&nbsp;[% END %]
<td class="r">[% IF results %]<a title="[% already_run_text %]" target="test_results" href="single_result.cgi?id=[% results.testresult_id %]"><img align="absmiddle" src="images/confirm.png" border="0" /></a>&nbsp;[% END %]
<a title="View Testcase ID#: [% curtest.testcase_id | html %]" href="show_test.cgi?id=[% curtest.testcase_id | uri | html %]">View</a>[% IF show_admin %]&nbsp;/&nbsp;<a title="Edit Testcase ID#: [% curtest.testcase_id | html %]" href="manage_testcases.cgi?testcase_id=[% curtest.testcase_id | uri | html %]">Edit</a>[% END %]</td>
</tr>
</table>