Merge lp:~ara/ubuntu-qa-website/fixes_578349_579155 into lp:~ubuntu-qa-website-devel/ubuntu-qa-website/trunk

Proposed by Ara Pulido
Status: Merged
Approved by: Brian Murray
Approved revision: 145
Merged at revision: 143
Proposed branch: lp:~ara/ubuntu-qa-website/fixes_578349_579155
Merge into: lp:~ubuntu-qa-website-devel/ubuntu-qa-website/trunk
Diff against target: 189 lines (+76/-35)
2 files modified
code/modules/qatracker/qatracker.display.php (+50/-13)
code/modules/qatracker/qatracker.function.php (+26/-22)
To merge this branch: bzr merge lp:~ara/ubuntu-qa-website/fixes_578349_579155
Reviewer Review Type Date Requested Status
Brian Murray Approve
Review via email: mp+26714@code.launchpad.net

Description of the change

This merge fixes a small bug (not trimming spaces in bug fields; bug 578349) and it adds a new feature: deleting own reports (bug 579155).

This feature has been requested by a lot of users, who often submit a report mistakenly in the wrong image or testcase.

To post a comment you must log in.
145. By Ara Pulido

Updated coverage report with new products and optional testcases

Revision history for this message
Ara Pulido (ara) wrote :

This merge request now also includes a fix for bug 495373

Revision history for this message
Brian Murray (brian-murray) wrote :

Its not obvious to me what changed in $tests=db_query.

Revision history for this message
Ara Pulido (ara) wrote :

> Its not obvious to me what changed in $tests=db_query.

This change is related to bug 495373, but it is not a new feature itself. While I was fixing the testcase coverage report, I realized that there was a previous bug in it. It was showing any testcase, no matter which site we were in. The ISO tracker manages each site (iso.qa.ubuntu.com, mozilla.qa.ubuntu.com, etc) with a siteid. This particular query wasn't specifying the siteid and, therefore, it was showing any active build of any site.

Revision history for this message
Brian Murray (brian-murray) wrote :

+ $content.="<tr><td style=\"width:25em;\" colspan=\"2\"><b>This product is not currently on the tracker</b></td></tr>";

I think that sentence could use a period at the end of it, the same thing might also be true of "You must select a result" and "you need to provide a bug number" as those are complete sentences. However, I'm not really certain if there is a convention for this or what it might be if there is one. ;-)

Anyway looks great!

review: Approve
146. By Ara Pulido

Added a period to error messages

Revision history for this message
Ara Pulido (ara) wrote :

I have added a period at the end of the error messages and have merged the changes. Thanks for the review!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'code/modules/qatracker/qatracker.display.php'
2--- code/modules/qatracker/qatracker.display.php 2010-04-16 11:26:57 +0000
3+++ code/modules/qatracker/qatracker.display.php 2010-06-22 13:43:23 +0000
4@@ -599,7 +599,7 @@
5 $resultID=db_query("SELECT id FROM qatracker_result WHERE buildid='".$buildID."' AND testcaseid='".$testcaseID."' AND reporterid='".$user->uid."' ");
6 $resultID=db_result($resultID);
7 if ($resultID) {
8- $content.="<br /><b>You have already posted a result, the form below lets you edit it :</b>";
9+ $content.="<br /><b>You have already posted a result, the form below lets you update it or delete it:</b>";
10 $content.=qatracker_addresult($resultID);
11 }
12 else
13@@ -621,8 +621,9 @@
14 "Alternate" => "Alternate",
15 "Desktop" => "Desktop",
16 "Ubuntu Server" => "Server",
17- "Ubuntu educational" => "Edubuntu Add-on",
18 "DVD" => "DVD",
19+ "Netbook" => "Netbook",
20+ "arm" => "ARM",
21 "Netboot" => "Netboot"
22 );
23 }
24@@ -635,7 +636,7 @@
25 $content="<br />This page shows how many times each testcase has been tested.<br />Testcases with no results are shown in red, with less than 5 results in orange and with more than 5 results in green.<br />This page doesn't show the result of those tests but only the coverage (if a testcase has 6 failed result it'll be shown in green anyway)";
26 foreach ($products as $product => $title) {
27 $content.="<h1>$title</h1><table class=\"listing\" style=\"width:auto;\">";
28- $tests=db_query("SELECT qatracker_testcase.title, count(qatracker_result.id) FROM qatracker_build LEFT JOIN qatracker_milestone ON qatracker_milestone.id=qatracker_build.milestoneid LEFT JOIN qatracker_result ON qatracker_result.buildid=qatracker_build.id LEFT JOIN qatracker_product ON qatracker_product.id=qatracker_build.productid RIGHT JOIN qatracker_testcase ON qatracker_testcase.productid=qatracker_product.id WHERE qatracker_testcase.status='0' AND qatracker_product.status='0' AND qatracker_product.title~'".$product."' AND qatracker_build.status='0' AND qatracker_milestone.status='0' AND ((qatracker_result.status='0' AND qatracker_result.result != '2' AND qatracker_testcase.id=qatracker_result.testcaseid) OR qatracker_result.status is Null) GROUP BY qatracker_testcase.title, substring(qatracker_product.title from '.* (.*) .*$')");
29+ $tests=db_query("SELECT qatracker_testcase.title, count(qatracker_result.id) FROM qatracker_build LEFT JOIN qatracker_milestone ON qatracker_milestone.id=qatracker_build.milestoneid LEFT JOIN qatracker_result ON qatracker_result.buildid=qatracker_build.id LEFT JOIN qatracker_product ON qatracker_product.id=qatracker_build.productid RIGHT JOIN qatracker_testcase ON qatracker_testcase.productid=qatracker_product.id WHERE qatracker_product.siteid='".$site->id."' AND qatracker_testcase.status='0' AND qatracker_product.status='0' AND qatracker_product.title~'".$product."' AND qatracker_build.status='0' AND qatracker_milestone.status='0' AND ((qatracker_result.status='0' AND qatracker_result.result != '2' AND qatracker_testcase.id=qatracker_result.testcaseid) OR qatracker_result.status is Null) GROUP BY qatracker_testcase.title, substring(qatracker_product.title from '.* (.*) .*$')");
30 $result=false;
31 while ($item = db_fetch_object($tests)) {
32 if ($item->count == 0)
33@@ -648,9 +649,26 @@
34 $result=true;
35 }
36 if (!$result)
37- $content.="<tr><td style=\"width:25em;\" colspan=\"2\"><b>This product is not currently on the tracker</b></td></tr>";
38+ $content.="<tr><td style=\"width:25em;\" colspan=\"2\"><b>This product is not currently on the tracker.</b></td></tr>";
39 $content.="</table>";
40+ }
41+ $content.="<h1>Optional Testcases</h1><table class=\"listing\" style=\"width:auto;\">";
42+ $tests=db_query("SELECT qatracker_testcase.title, count(qatracker_result.id) FROM qatracker_build LEFT JOIN qatracker_milestone ON qatracker_milestone.id=qatracker_build.milestoneid LEFT JOIN qatracker_result ON qatracker_result.buildid=qatracker_build.id LEFT JOIN qatracker_testcase ON qatracker_result.testcaseid = qatracker_testcase.id LEFT JOIN qatracker_product ON qatracker_product.id = qatracker_testcase.productid WHERE qatracker_product.siteid='".$site->id."' AND qatracker_testcase.status='2' AND qatracker_build.status='0' AND qatracker_milestone.status='0' AND ((qatracker_result.status='0' AND qatracker_result.result != '2' AND qatracker_testcase.id=qatracker_result.testcaseid) OR qatracker_result.status is Null) GROUP BY qatracker_testcase.title");
43+ $result=false;
44+ while ($item = db_fetch_object($tests)) {
45+ if ($item->count == 0)
46+ $count="<span style=\"color:red; font-weight:bold;\">".$item->count." tests done</span>";
47+ elseif ($item->count > 5)
48+ $count="<span style=\"color:green; font-weight:bold;\">".$item->count." tests done</span>";
49+ else
50+ $count="<span style=\"color:orange; font-weight:bold;\">".$item->count." tests done</span>";
51+ $content.="<tr><td style=\"width:25em;\"><b>".$item->title."</b></td><td>$count</td></tr>";
52+ $result=true;
53 }
54+ if (!$result)
55+ $content.="<tr><td style=\"width:25em;\" colspan=\"2\"><b>This product is not currently on the tracker.</b></td></tr>";
56+ $content.="</table>";
57+
58 return $content;
59 }
60
61@@ -661,7 +679,7 @@
62 while ($milestone=db_fetch_object($milestones))
63 $content.=qatracker_buildstat($milestone->id);
64 if (strlen($content) == 0)
65- $content="<br /><b>There is no milestone being currently tested</b>";
66+ $content="<br /><b>There is no milestone being currently tested.</b>";
67 return $content;
68 }
69
70@@ -881,7 +899,9 @@
71 $content.="<input type=\"checkbox\" name=\"isot_status\" value=\"1\" $select /> Hide this report<br />";
72 }
73 if ($resultID != 0) {
74- $content.="<input type=\"hidden\" name=\"isot_edit\" value=\"1\"/><input type=\"submit\" name=\"isot_valid\" value=\"Edit result\"/>";
75+ $content.="<input type=\"hidden\" name=\"isot_valid\" value=\"1\"/><input type=\"submit\" name=\"isot_edit\" value=\"Update result\"/>";
76+ $content.="<br /><br/>Or you can also delete it if you made a mistake...&nbsp;&nbsp;&nbsp;";
77+ $content.="<input type=\"submit\" name=\"isot_edit\" value=\"Delete result\" />";
78 }
79 else
80 $content.="<input type=\"submit\" style=\"width:12em\" name=\"isot_valid\" value=\"Submit result\"/>";
81@@ -897,7 +917,7 @@
82 if ($data['isot_error']) {
83 return qatracker_addresult($isodID, 0);
84 }
85- if ($data['isot_edit'] == "1") {
86+ if ($data['isot_edit'] == "Update result" || $data['isot_edit'] == "Delete result") {
87 $id=db_query("SELECT id FROM qatracker_result WHERE buildid='".$buildID."' AND testcaseid='".$testcaseID."' AND reporterid='".$user->uid."' ");
88 $resultID=db_result($id);
89 if ($admin == 1 && $resultID1 != 0) {
90@@ -911,18 +931,35 @@
91 db_query("UPDATE qatracker_result SET result='".db_escape_string($data['isot_result'])."', lastchange='".date("Y-m-d H:i:s")."', comment='".db_escape_string($data['isot_comment'])."', changedby='".$user->uid."', status='".db_escape_string($status)."' WHERE id='".db_escape_string($resultID)." '");
92 }
93 else
94- db_query("UPDATE qatracker_result SET result='".db_escape_string($data['isot_result'])."', lastchange='".date("Y-m-d H:i:s")."', comment='".db_escape_string($data['isot_comment'])."' WHERE id='".db_escape_string($resultID)." '");
95- db_query("DELETE FROM qatracker_bug WHERE resultid='".$resultID."'");
96+ if ($data['isot_edit'] == "Update result") {
97+ db_query("UPDATE qatracker_result SET result='".db_escape_string($data['isot_result'])."', lastchange='".date("Y-m-d H:i:s")."', comment='".db_escape_string($data['isot_comment'])."' WHERE id='".db_escape_string($resultID)." '");
98+ }
99+ else {
100+ db_query("DELETE FROM qatracker_result WHERE id='".$resultID."'");
101+ }
102+ db_query("DELETE FROM qatracker_bug WHERE resultid='".$resultID."'");
103 }
104 else {
105 if (db_result(db_query("SELECT count(id) FROM qatracker_result WHERE buildid='".$buildID."' AND testcaseid='".$testcaseID."' AND reporterid='".$user->uid."'"))=="0")
106 db_query("INSERT INTO qatracker_result (buildid, testcaseid, reporterid, date, comment, result) VALUES (".$buildID.",".$testcaseID.",".$user->uid.",'".date("Y-m-d H:i:s")."','".db_escape_string($data['isot_comment'])."','".db_escape_string($data['isot_result'])."')");
107 $resultID=db_result(db_query("SELECT id FROM qatracker_result WHERE buildid=".$buildID." AND testcaseid=".$testcaseID." AND reporterid=".$user->uid.""));
108 }
109- $valid=0;
110- foreach ($data['isot_bug'] as $bugnumber => $bugimportance)
111- db_query("INSERT INTO qatracker_bug (resultid, bugnumber, bugimportance) VALUES ('".$resultID."','".db_escape_string($bugnumber)."','".db_escape_string($bugimportance)."')");
112- drupal_set_message("Thank you for your report.", "notice_msg");
113+ $valid=0;
114+ if ($data['isot_edit'] != "Delete result") {
115+ foreach ($data['isot_bug'] as $bugnumber => $bugimportance)
116+ db_query("INSERT INTO qatracker_bug (resultid, bugnumber, bugimportance) VALUES ('".$resultID."','".db_escape_string($bugnumber)."','".db_escape_string($bugimportance)."')");
117+ }
118+
119+ if ($data['isot_edit'] == "Delete result") {
120+ drupal_set_message("Your result has been successfully deleted.", "notice_msg");
121+ }
122+ else if ($data['isot_edit'] == "Update result") {
123+ drupal_set_message("Your report has been updated.", "notice_msg");
124+ }
125+ else {
126+ drupal_set_message("Thank you for your report.", "notice_msg");
127+ }
128+
129 drupal_set_header("Location: $base_url/qatracker/result/$buildID/$testcaseID");
130 return null;
131 }
132
133=== modified file 'code/modules/qatracker/qatracker.function.php'
134--- code/modules/qatracker/qatracker.function.php 2009-12-21 14:53:47 +0000
135+++ code/modules/qatracker/qatracker.function.php 2010-06-22 13:43:23 +0000
136@@ -20,28 +20,32 @@
137 function qatracker_checkpostvalue() {
138 $data=$_POST;
139 $data['isot_comment']=htmlentities($data['isot_comment'],ENT_QUOTES,"UTF-8");
140- $data['isot_bug']=array();
141- $count=0;
142- if ($data['isot_bugnumber']) {
143- foreach ($data['isot_bugnumber'] as $bug) {
144- if ($data['isot_serious'] && in_array($count,$data['isot_serious']))
145- $serious=1;
146- else
147- $serious=0;
148- if (is_numeric($bug))
149- array_push_associative($data['isot_bug'], array($bug => $serious));
150- elseif ($bug == "")
151- $data['isot_error'].="";
152- else
153- $data['isot_error'].="<font color=\"red\">Invalid value (".htmlentities($bug,ENT_QUOTES,"UTF-8").")</font><br />";
154- $count++;
155- }
156- }
157- if ((!is_numeric($data['isot_result'])) && ($data['isot_valid'] || $data['isot_addbug'])) {
158- $data['isot_error'].="<font color=\"red\">You must select a result</font><br />";
159- }
160- if (($data['isot_result'] == 0) && (count($data['isot_bug']) == 0) && ($_SERVER['REQUEST_METHOD'] === 'POST'))
161- $data['isot_error'].="<font color=\"red\">To mark a test as failed, you need to provide a bug number</font><br />";
162+ $data['isot_bug']=array();
163+ $count=0;
164+
165+ // If we are deleting do not check anything
166+ if ($data['isot_edit'] != "Delete result") {
167+ if ($data['isot_bugnumber']) {
168+ foreach ($data['isot_bugnumber'] as $bug) {
169+ if ($data['isot_serious'] && in_array($count,$data['isot_serious']))
170+ $serious=1;
171+ else
172+ $serious=0;
173+ if (is_numeric(trim($bug)))
174+ array_push_associative($data['isot_bug'], array(trim($bug) => $serious));
175+ elseif ($bug == "")
176+ $data['isot_error'].="";
177+ else
178+ $data['isot_error'].="<font color=\"red\">Invalid value (".htmlentities($bug,ENT_QUOTES,"UTF-8").")</font><br />";
179+ $count++;
180+ }
181+ }
182+ if ((!is_numeric($data['isot_result'])) && ($data['isot_valid'] || $data['isot_addbug'])) {
183+ $data['isot_error'].="<font color=\"red\">You must select a result.</font><br />";
184+ }
185+ if (($data['isot_result'] == 0) && (count($data['isot_bug']) == 0) && ($_SERVER['REQUEST_METHOD'] === 'POST'))
186+ $data['isot_error'].="<font color=\"red\">To mark a test as failed, you need to provide a bug number.</font><br />";
187+ }
188 return $data;
189 }
190

Subscribers

People subscribed via source and target branches

to status/vote changes: