Merge lp:~primes2h/ubuntu-qa-website/implement_laptop_testing into lp:~ubuntu-qa-website-devel/ubuntu-qa-website/trunk

Proposed by Sergio Zanchetta on 2011-02-18
Status: Merged
Merged at revision: 153
Proposed branch: lp:~primes2h/ubuntu-qa-website/implement_laptop_testing
Merge into: lp:~ubuntu-qa-website-devel/ubuntu-qa-website/trunk
Diff against target: 377 lines (+280/-10)
2 files modified
code/modules/qatracker/qatracker.display.php (+255/-2)
code/modules/qatracker/qatracker.function.php (+25/-8)
To merge this branch: bzr merge lp:~primes2h/ubuntu-qa-website/implement_laptop_testing
Reviewer Review Type Date Requested Status
Jean-Baptiste Lallement 2011-02-18 Approve on 2011-03-07
Review via email: mp+50309@code.launchpad.net

Description of the change

* Implement laptop testing in QA-Tracker showing a summary of tested laptops and a report for each of them.
* add a logo.

Some slight changes need to be made in the db:
* add laptoptesting_logo.png in the qawebsite_site table
* delete Ubuntu Netbook Edition as product in qatracker_product
* delete Input/Output - Trackpad (Mac only) testcase from qatracker_testcase for each product since I merged it in Input/Output - Touchpad testcase.
* change laptop info field size in qawebsite_user_setting in this way:

   1. Manufacturer: (50 characters wide x 1 line)
   2. Model: (50 characters wide x 1 line)
   3. PCI device list (140 characters wide x 400 line)
      P.S.: change command in description with "lspci -v" (old one was "lspci" only)

   4. USB devices list (100 characters wide x 35 line)
   5. Hardware configuration list (120 characters wide x 100 line)

* Milestone names for tests should be added in the form
  "Release-name milestone-name" (e.g. Natty Alpha 3, Natty Beta etc.)
  Fake milestones for trial tests should be like
  "FakeNatty Alpha 3" or "Natty Fake Alpha 3" or "Natty Alpha 3 Fake"

To post a comment you must log in.
Jean-Baptiste Lallement (jibel) wrote :

Great work. It looks good, I'm now testing the update in a dev environment for any side-effect.

Jean-Baptiste Lallement (jibel) wrote :

Could you update the title of the logo to look the same as http://desktop.qa.ubuntu.com/modules/qawebsite/images/logo/ubuntu-logo.png (non bold ubuntu font) We'll try to keep some consistency through the *.qa.ubuntu.com.

155. By Sergio Zanchetta on 2011-02-28

Changed laptop tracker logo using non-bold ubuntu font

Sergio Zanchetta (primes2h) wrote :

> Could you update the title of the logo to look the same as
> http://desktop.qa.ubuntu.com/modules/qawebsite/images/logo/ubuntu-logo.png
> (non bold ubuntu font) We'll try to keep some consistency through the
> *.qa.ubuntu.com.

Done.Thanks for the suggestion.

Jean-Baptiste Lallement (jibel) wrote :

thnaks for the update.

review: Approve

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-10-13 10:36:19 +0000
3+++ code/modules/qatracker/qatracker.display.php 2011-02-28 17:05:46 +0000
4@@ -1,6 +1,7 @@
5 <?php
6 /*
7 Copyright (C) 2007 Stephane Graber <stgraber@ubuntu.com>
8+Copyright (C) 2010-2011 Sergio Zanchetta <primes2h@ubuntu.com>
9
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License
12@@ -129,6 +130,16 @@
13 else
14 return drupal_access_denied();
15 break;
16+ case "laptop":
17+ if ($site->id == 12) {
18+ if (count($args) > 2)
19+ $content=qatracker_laptopreport($args[2],$args[1]);
20+ else
21+ $content=qatracker_laptopsummary();
22+ }
23+ else
24+ return drupal_not_found();
25+ break;
26 default:
27 return drupal_not_found();
28 break;
29@@ -851,6 +862,245 @@
30 return $content;
31 }
32
33+function qatracker_laptopreport($reporterID,$release) {
34+ global $site;
35+ $laptop_settings= db_query("SELECT
36+ qawebsite_user_setting.title,
37+ qawebsite_user_setting_info.value
38+ FROM qawebsite_user_setting
39+ LEFT JOIN qawebsite_user_setting_info ON qawebsite_user_setting.id=qawebsite_user_setting_info.settingid
40+ WHERE userid='".$reporterID."' AND siteid='".$site->id."'");
41+
42+ $lpusername = db_result(db_query("SELECT value from qawebsite_user_setting_info WHERE userid='".$reporterID."' AND settingid='1'"));
43+ $reporter = db_result(db_query("SELECT name from users WHERE uid='".$reporterID."'"));
44+ if ($reporter == null)
45+ return "";
46+
47+ $laptopnameitem=array();
48+ for ($i = 0;$i < 2; $i++)
49+ array_push($laptopnameitem,db_fetch_object($laptop_settings)->value);
50+
51+ $laptopname=implode(" ",$laptopnameitem);
52+ $content.="<h1>".$laptopname."</h1><br \>";
53+ $content.="
54+ <h3>Reporter: &nbsp; &nbsp;".$reporter."&nbsp; → &nbsp; <a rel=\"external\" href=\"https://launchpad.net/".$lpusername."\">".$lpusername."</a></h3><br \>";
55+ if (db_result(db_query("SELECT count(id) FROM qatracker_milestone WHERE title LIKE '".$release."%'")) == "0")
56+ $content.=" <h1>This release is not present on the tracker</h1>";
57+
58+ $products=db_query("SELECT id FROM qatracker_product WHERE siteid='".$site->id."'");
59+ while ($product=db_fetch_object($products)) {
60+ if (db_result(db_query("SELECT
61+ count(qatracker_result.id)
62+ FROM qatracker_result
63+ LEFT JOIN qatracker_build ON qatracker_result.buildid=qatracker_build.id
64+ LEFT JOIN qatracker_milestone ON qatracker_build.milestoneid=qatracker_milestone.id
65+ WHERE reporterid='".$reporterID."' AND productid='".$product->id."' AND title LIKE '".$release."%'")) != "0") {
66+ $content.=qatracker_laptopstat($product->id,$reporterID,$release);
67+ $content.="<br />";
68+ $content.="<br />";
69+ }
70+ }
71+ $content.="<br />
72+ <h2>Hardware information:</h2>";
73+ while($laptop_setting = db_fetch_object($laptop_settings)) {
74+ $laptop_setting->title=substr($laptop_setting->title,3);
75+ $content.="
76+ <table class=\"listing\" style=\"width:auto;\">
77+ <tr><td><b>".$laptop_setting->title."</b></td></tr>
78+ <tr><td>".nl2br($laptop_setting->value)."</td></tr>
79+ </table><br />";
80+ }
81+ return $content;
82+}
83+
84+function qatracker_laptopstat($productID,$reporterID,$release) {
85+ global $base_url, $site;
86+
87+ $query=db_query("SELECT
88+ qatracker_build.id AS build, title as milestone
89+ FROM qatracker_build
90+ LEFT JOIN qatracker_milestone ON qatracker_build.milestoneid=qatracker_milestone.id
91+ WHERE siteid='".$site->id."' AND title LIKE '".$release."%' AND productid='".$productID."'
92+ ORDER BY qatracker_milestone.id");
93+
94+ $testcases=db_query("SELECT id,title FROM qatracker_testcase WHERE productid='".$productID."'");
95+ $product = db_result(db_query("SELECT title from qatracker_product WHERE id='".$productID."'"));
96+
97+ $milestones=array();
98+ while ($item = db_fetch_object($query)) {
99+ array_push_associative($milestones, array($item->build => $item->milestone));
100+ }
101+ $content.="
102+ <table cellpadding=\"10\">
103+ <caption><h2>".$release." - ".$product.":</h2></caption>
104+ <tr class=\"trheader\"><td style=\"width:230px;\"><b>Testcase</b></td>";
105+ $archive=array();
106+ foreach ($milestones as $build => $milestone) {
107+ $milestonename=substr($milestone,strpos($milestone,' '));
108+ $status=db_result(db_query("SELECT status FROM qatracker_milestone WHERE qatracker_milestone.title='".$milestone."'"));
109+ switch($status) {
110+ case "0":
111+ $content.="<td style=\"width:170px;text-align:center;\"><p><b>".$milestonename."</b></p><p style=\"color:red;\"><b>Testing</b></p></td>";
112+ array_push_associative($archive,array($milestone => 0));
113+ break;
114+ case "1":
115+ $content.="<td style=\"width:170px;text-align:center;\"><p><b>".$milestonename."</b></p><p style=\"color:red;\"><b>Released</b></p></td>";
116+ array_push_associative($archive,array($milestone => 0));
117+ break;
118+ case "2":
119+ $content.="<td style=\"width:170px;text-align:center;\"><p><b>".$milestonename."</b></p><p style=\"color:red;\"><b>Archived</b></p></td>";
120+ array_push_associative($archive,array($milestone => 1));
121+ break;
122+ }
123+ }
124+ $content.="</tr>";
125+
126+ $item=array();
127+ $countv=0;
128+ $lastcategory="";
129+ while($testcase = db_fetch_object($testcases)) {
130+ $title=explode(" - ", $testcase->title);
131+ $category=$title[0];
132+ if ($category!=$lastcategory) {
133+ $countv++;
134+ $content.="<tr><td style=\"background-color:#f6f6f6;\"><b><a href=\"javascript:ShowHide('block".$productID."".$countv."')\"> [+] ".$category." (click to expand)</a></b></td>";
135+ foreach($milestones as $build => $milestone) {
136+ $category_stat = qatracker_getbuildstat($build,$archive[$milestone],0,$reporterID,$category);
137+ $content.="<td style=\"display:table-cell\" align=\"center\" class=\"block".$productID."".$countv."\">".$category_stat."</td>";
138+ }
139+ $lastcategory=$category;
140+ $content.="</tr>";
141+ }
142+ $content.=" <tr class=\"block".$productID."".$countv."\" style=\"display:none;\">
143+ <td style=\"width=230px;\">&nbsp; <img style=\"margin-bottom:0px;\" src=\"$base_url/modules/qatracker/images/test.png\" alt=\"spacer\" /> ".$title[1]."</td>";
144+ foreach($milestones as $build => $milestone) {
145+ $results=db_fetch_object(db_query("SELECT result,comment FROM qatracker_result WHERE reporterid='".$reporterID."' AND buildid='".$build."' AND testcaseid='".$testcase->id."'"));
146+ if ($results->result != null) {
147+ $content.="<td style=\"text-align:center;\">";
148+ if ($results->comment != null) {
149+ $content.="<b style=\"margin-right:-32px;font-size:10px;\">?</b>
150+ <div class=\"balloonleft\" style=\"margin-bottom:0px;\"><div>
151+ <b>Comment: <br \></b>".$results->comment."</div>";
152+ }
153+ switch($results->result) {
154+ case "0":
155+ $content.=" <a rel=\"external\" href=\"$base_url/qatracker/result/".$build."/".$testcase->id."\">
156+ <img style=\"margin-bottom:0px;\" src=\"$base_url/modules/qatracker/images/fail.png\" alt=\"spacer\" /></a></div>";
157+ break;
158+ case "1":
159+ $content.=" <a rel=\"external\" href=\"$base_url/qatracker/result/".$build."/".$testcase->id."\">
160+ <img style=\"margin-bottom:0px;\" src=\"$base_url/modules/qatracker/images/pass.png\" alt=\"spacer\" /></a></div>";
161+ break;
162+ }
163+ $content.="&nbsp;".qatracker_getbugslist($build, $testcase->id, 0)."<br \></td>";
164+ }
165+ else
166+ $content.="<td cellpadding=\"10\" style=\"text-align:center;font-size:10px;\">Not <br \> tested</td>";
167+ }
168+ $content.=" </tr>";
169+ }
170+ $content.=" </table>";
171+ return $content;
172+}
173+
174+function qatracker_laptopsummary() {
175+ global $base_url, $site;
176+
177+ $content.="<p><br /><b>Laptops tested so far:</b><br /><br /></p>";
178+ $content.=" <table class=\"listing\" style=\"padding-bottom:2em;\">
179+ <tr class=\"trheader\">
180+ <td align=\"left\"><b>Laptop</b></td>
181+ <td style=\"align=\"left\"><b>Reporter</b></td>
182+ <td style=\"align=\"left\"><b>Report</b></td>
183+ </tr>";
184+
185+ $laptops=db_query("SELECT DISTINCT
186+ name,settingid,value
187+ FROM qatracker_result
188+ LEFT JOIN users ON qatracker_result.reporterid=users.uid
189+ LEFT JOIN qawebsite_user_setting_info ON users.uid=qawebsite_user_setting_info.userid
190+ WHERE (settingid='1' OR settingid='8' OR settingid='9') ORDER BY name,settingid ASC");
191+ $laptopnameitem=array();
192+ $lpusername=array();
193+ $laptop=array();
194+ while ($item = db_fetch_object($laptops)) {
195+ switch($item->settingid) {
196+ case "1":
197+ array_push_associative($lpusername,array($item->name => $item->value));
198+ break;
199+ case "8":
200+ if ($item->value!='')
201+ array_push($laptopnameitem,$item->value);
202+ break;
203+ case "9":
204+ if ($item->value!='') {
205+ array_push($laptopnameitem,$item->value);
206+ array_push_associative($laptop,array($item->name => implode(" ", $laptopnameitem)));
207+ $laptopnameitem=array();
208+ }
209+ break;
210+ }
211+ }
212+ asort($laptop);
213+
214+ $milestones=db_query("SELECT title FROM qatracker_milestone WHERE siteid='".$site->id."' ORDER BY id");
215+
216+ $release=array();
217+ $lastreleasename='';
218+ while ($milestone = db_fetch_object($milestones)) {
219+ $releasename=substr($milestone->title,0,strpos($milestone->title," "));
220+ if ($releasename!=$lastreleasename) {
221+ array_push($release,$releasename);
222+ }
223+ $lastreleasename=$releasename;
224+ }
225+
226+ $lastlaptopmake='';
227+ foreach($laptop as $reporter => $laptopname) {
228+ $laptopmake = substr($laptopname,0,strpos($laptopname," "));
229+ $reporterID=db_result(db_query("SELECT uid from users where name='".$reporter."'"));
230+ if ($lastlaptopmake != $laptopmake) {
231+ $countv++;
232+ $content.="<tr><td colspan=\"3\" style=\"background-color:#e6e6e6;\"><b>".$laptopmake."</b></td></tr>";
233+ }
234+ $content.=" <tr>
235+ <td style=\"width:20%;\">&nbsp;".$laptopname."</td>
236+ <td style=\"width:30%;\">&nbsp;".$reporter."&nbsp;→&nbsp;<a rel=\"external\" href=\"https://launchpad.net/~".$lpusername[$reporter]."\">".$lpusername[$reporter]."</a></td>";
237+
238+ $content.=" <td><table>";
239+ foreach ($release as $name) {
240+ $query=db_query("SELECT qatracker_product.title as product,count(qatracker_result.id) as result from qatracker_result
241+ LEFT JOIN qatracker_build ON qatracker_build.id=qatracker_result.buildid
242+ LEFT JOIN qatracker_milestone ON qatracker_milestone.id=qatracker_build.milestoneid
243+ LEFT JOIN qatracker_product ON qatracker_product.id=qatracker_build.productid
244+ LEFT JOIN users ON qatracker_result.reporterid=users.uid
245+ WHERE users.name='".$reporter."' AND qatracker_milestone.title like '".$name."%' GROUP BY product");
246+ $first=True;
247+ while($item = db_fetch_object($query)) {
248+ if ($first)
249+ $content.="<tr>
250+ <td style=\"width:auto;text-align:left\"><a rel=\"external\" href=\"$base_url/qatracker/laptop/".$name."/".$reporterID."\">".$name."</a>&nbsp;</td>
251+ <td>&nbsp;(";
252+ else
253+ $content.=", ";
254+
255+ $content.="".$item->product."";
256+ $first=False;
257+ }
258+ if (!$first)
259+ $content.=")</td></tr>";
260+ else
261+ $content.="</td></tr>";
262+ }
263+ $lastlaptopmake=$laptopmake;
264+
265+ $content.=" </table></td></tr>";
266+ }
267+
268+ $content.=" </table>";
269+ return $content;
270+}
271+
272 function qatracker_buildstat($milestoneID) {
273 if (!is_numeric($milestoneID))
274 return "";
275@@ -911,7 +1161,7 @@
276 $content.="</table>";
277 $optional_testcases=db_query("SELECT
278 qatracker_bug.bugnumber,
279- count(qatracker_bug.bugnumber) as dupe
280+ count(qatracker_bug.bugnumber) as dupe
281 FROM qatracker_bug
282 LEFT JOIN qatracker_result ON qatracker_result.id=qatracker_bug.resultid
283 LEFT JOIN qatracker_build ON qatracker_build.id=qatracker_result.buildid
284@@ -959,7 +1209,7 @@
285 $content.="</table>";
286 $previous_bugs=db_query("SELECT
287 qatracker_bug.bugnumber,
288- count(qatracker_bug.bugnumber) as dupe
289+ count(qatracker_bug.bugnumber) as dupe
290 FROM qatracker_bug
291 LEFT JOIN qatracker_result ON qatracker_result.id=qatracker_bug.resultid
292 LEFT JOIN qatracker_build ON qatracker_build.id=qatracker_result.buildid
293@@ -2121,6 +2371,9 @@
294 if (user_access("Registered User")) {
295 $menu['Actions']['My subscriptions']="/qatracker/user/subscription";
296 }
297+ if ($site->id == 12) {
298+ $menu['Actions']['Laptops summary']="/qatracker/laptop";
299+ }
300
301 //Administration pages
302 if (user_access($site->adminrole)) {
303
304=== modified file 'code/modules/qatracker/qatracker.function.php'
305--- code/modules/qatracker/qatracker.function.php 2010-10-13 10:36:19 +0000
306+++ code/modules/qatracker/qatracker.function.php 2011-02-28 17:05:46 +0000
307@@ -1,6 +1,7 @@
308 <?php
309 /*
310 Copyright (C) 2007 Stephane Graber <stgraber@ubuntu.com>
311+Copyright (C) 2010-2011 Sergio Zanchetta <primes2h@ubuntu.com>
312
313 This program is free software; you can redistribute it and/or
314 modify it under the terms of the GNU General Public License
315@@ -172,23 +173,39 @@
316 else
317 $path.=" -> <a href=\"/qatracker/archive/".$site->getSetting('default_product')."\">".$site->getSetting('default_product')."</a>";
318 break;
319+ case "laptop":
320+ if (count($args) > 2)
321+ $path.=" -> <a href=\"/qatracker/laptop/".$args[1]."/".$args[2]."\">Laptop report - ".$args[1]."</a>";
322+ else
323+ $path.=" -> <a href=\"/qatracker/laptop\">Laptops summary</a>";
324+ break;
325 }
326 $path.="</span>";
327 return $path;
328 }
329
330-function qatracker_getbuildstat($buildID,$archive=0,$status=0) {
331-
332- $total=db_query("SELECT count(title) from qatracker_testcase LEFT JOIN qatracker_build ON qatracker_build.productid=qatracker_testcase.productid WHERE qatracker_build.id='$buildID' AND qatracker_testcase.status='$status'");
333+function qatracker_getbuildstat($buildID,$archive=0,$status=0,$reporterID=0,$testcasecat = "All") {
334+
335+ if ($testcasecat != "All")
336+ $and_title="AND qatracker_testcase.title LIKE '".db_escape_string($testcasecat)."%'";
337+ else
338+ $and_title="";
339+
340+ if ($reporterID != 0)
341+ $and_reporter="AND qatracker_result.reporterid='".db_escape_string($reporterID)."'";
342+ else
343+ $and_reporter="";
344+
345+ $total=db_query("SELECT count(title) from qatracker_testcase LEFT JOIN qatracker_build ON qatracker_build.productid=qatracker_testcase.productid WHERE qatracker_build.id='$buildID' AND qatracker_testcase.status='$status' $and_title");
346 $total=db_result($total);
347
348 if ($total==0)
349 return "None";
350
351- $done=db_query("SELECT count(DISTINCT testcaseID) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_result.buildid='".$buildID."' AND qatracker_result.status='0' AND qatracker_result.result != '2' AND qatracker_testcase.status='$status'");
352+ $done=db_query("SELECT count(DISTINCT testcaseID) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_result.buildid='".$buildID."' AND qatracker_result.status='0' AND qatracker_result.result != '2' AND qatracker_testcase.status='$status' $and_title $and_reporter");
353 $done=db_result($done);
354
355- $started=db_query("SELECT count(DISTINCT testcaseID) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_result.buildid='".$buildID."' AND qatracker_result.status='0' AND qatracker_result.result='2' AND qatracker_testcase.status='$status'");
356+ $started=db_query("SELECT count(DISTINCT testcaseID) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_result.buildid='".$buildID."' AND qatracker_result.status='0' AND qatracker_result.result='2' AND qatracker_testcase.status='$status' $and_title $and_reporter");
357 $started=db_result($started);
358
359 if ($started != 0)
360@@ -196,11 +213,11 @@
361 else
362 $started = "";
363
364- $donet=db_query("SELECT count(DISTINCT testcaseID) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_result.buildid='".$buildID."' AND qatracker_result.result != '2' AND qatracker_result.status='0'");
365+ $donet=db_query("SELECT count(DISTINCT testcaseID) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_result.buildid='".$buildID."' AND qatracker_result.result != '2' AND qatracker_result.status='0' $and_title $and_reporter");
366 $donet=db_result($donet);
367- $reports=db_query("SELECT count(qatracker_result.id) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_testcase.status='0' AND buildid='".$buildID."' AND qatracker_result.status='0'");
368+ $reports=db_query("SELECT count(qatracker_result.id) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_testcase.status='0' AND buildid='".$buildID."' AND qatracker_result.status='0' $and_title $and_reporter");
369 $reports=db_result($reports);
370- $fail=db_query("SELECT count(qatracker_result.id) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_testcase.status='0' AND buildid='".$buildID."' AND qatracker_result.status='0' AND result='0'");
371+ $fail=db_query("SELECT count(qatracker_result.id) from qatracker_result LEFT JOIN qatracker_testcase ON qatracker_testcase.id=qatracker_result.testcaseid WHERE qatracker_testcase.status='0' AND buildid='".$buildID."' AND qatracker_result.status='0' AND result='0' $and_title $and_reporter");
372 $fail=db_result($fail);
373 if ($archive == 1)
374 $total=$done;
375
376=== added file 'code/modules/qawebsite/images/logo/laptoptesting-logo.png'
377Binary files code/modules/qawebsite/images/logo/laptoptesting-logo.png 1970-01-01 00:00:00 +0000 and code/modules/qawebsite/images/logo/laptoptesting-logo.png 2011-02-28 17:05:46 +0000 differ

Subscribers

People subscribed via source and target branches

to status/vote changes: