Merge lp:~nskaggs/ubuntu-qa-website/revert-tracker-defect-changes into lp:ubuntu-qa-website

Proposed by Nicholas Skaggs on 2016-03-24
Status: Merged
Merged at revision: 429
Proposed branch: lp:~nskaggs/ubuntu-qa-website/revert-tracker-defect-changes
Merge into: lp:ubuntu-qa-website
Diff against target: 135 lines (+47/-60)
1 file modified
modules/qatracker/report/qatracker.report.defects.php (+47/-60)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-qa-website/revert-tracker-defect-changes
Reviewer Review Type Date Requested Status
Kev Bowring 2016-03-24 Approve on 2016-03-30
Review via email: mp+290038@code.launchpad.net

Commit Message

Revert the changes to the defects tracker page to fix bug 1541586

Description of the Change

Revert the changes to the defects tracker page to fix https://bugs.launchpad.net/ubuntu-qa-website/+bug/1541586

To post a comment you must log in.
Kev Bowring (flocculant) wrote :

looks like the code we have to revert

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/qatracker/report/qatracker.report.defects.php'
2--- modules/qatracker/report/qatracker.report.defects.php 2016-01-09 00:57:11 +0000
3+++ modules/qatracker/report/qatracker.report.defects.php 2016-03-24 13:54:32 +0000
4@@ -45,66 +45,53 @@
5 return $content;
6 }
7
8-function qatracker_getbugs_for_release($siteid, $header) {
9+function qatracker_getbugs_for_release($siteid) {
10 /*
11 * Get all the bugs for all the milestones of a release
12 * for a given siteid
13 */
14- $query = db_select('qatracker_build', 'b')
15- ->extend('TableSort')
16- ->extend('PagerDefault');
17- $query->distinct();
18- $query->addField('m', 'title', 'mtitle');
19- $query->fields('l', array(
20- 'bugnumber',
21- 'product',
22- 'title'));
23- $query->addField('l', 'title', 'btitle');
24- $query->fields('l', array(
25- 'status',
26- 'importance',
27- 'assignee',
28- 'commentscount',
29- 'duplicatescount',
30- 'subscriberscount'
31- ));
32- $query->addField('m', 'id');
33- $query->addExpression("CASE
34+
35+ $result = db_query("
36+SELECT DISTINCT m.title mtitle
37+ ,l.bugnumber
38+ ,l.product
39+ ,l.title btitle
40+ ,l.status
41+ ,l.importance
42+ ,l.assignee
43+ ,l.commentscount
44+ ,l.duplicatescount
45+ ,l.subscriberscount
46+ ,m.id
47+ ,(CASE
48 WHEN l.importance = 'Critical' THEN 0
49 WHEN l.importance = 'High' THEN 1
50 WHEN l.importance = 'Medium' THEN 2
51 WHEN l.importance = 'Low' THEN 3
52 WHEN l.importance = 'Undecided' THEN 10
53- ELSE 5 END", 'importance_order');
54- $query->join('qatracker_product', 'p', 'p.id = b.productid');
55- $query->join('qatracker_build_milestone', 'bm', 'bm.buildid = b.id');
56- $query->join('qatracker_milestone', 'm', 'bm.milestoneid = m.id');
57- $query->join('qatracker_testsuite_product', 'tp', 'tp.productid = b.productid AND tp.milestone_seriesid = m.seriesid');
58- $query->join('qatracker_testsuite_testcase', 'tt', 'tt.testsuiteid = tp.testsuiteid');
59- $query->join('qatracker_testcase', 't', 'tt.testcaseid = t.id');
60- $query->join('qatracker_result', 'r', '(r.testcaseid = t.id AND r.buildid = b.id)');
61- $query->join('qatracker_bug', 'g', 'g.resultid = r.id');
62- $query->join('qatracker_launchpad_bug', 'l', 'g.bugnumber = l.originalbug');
63- $query->condition('m.siteid', intval($siteid));
64-
65- $subquery = db_select('qatracker_milestone', 'm2');
66- $subquery->distinct();
67- $subquery->addExpression("SUBSTRING(m2.title, '^[^ ]+')");
68- $or = db_or();
69- $or->condition('m2.status', 0, '=');
70- $or->condition('m2.status', 1, '=');
71- $subquery->condition($or);
72- $subquery->condition('m2.siteid', 'm.siteid');
73-
74- $query->addExpression("SUBSTRING(m.title, '^[^ ]+') IN (" . $subquery->__toString() . ')');
75- $or = db_or();
76- $or->condition('tt.status', 0, '=');
77- $or->condition('tt.status', 2, '=');
78- $query->condition($or);
79- $query->condition('tt.status', array(0, 2), 'IN');
80- $query->orderBy('m.id', 'DESC');
81- $query->orderByHeader($header);
82- return $query->execute()->fetchAll();
83+ ELSE 5 END
84+ ) importance_order
85+FROM qatracker_build b
86+JOIN qatracker_product p ON p.id = b.productid
87+JOIN qatracker_build_milestone bm ON bm.buildid = b.id
88+JOIN qatracker_milestone m ON bm.milestoneid = m.id
89+JOIN qatracker_testsuite_product tp ON tp.productid = b.productid AND tp.milestone_seriesid = m.seriesid
90+JOIN qatracker_testsuite_testcase tt ON tt.testsuiteid = tp.testsuiteid
91+JOIN qatracker_testcase t ON tt.testcaseid = t.id
92+JOIN qatracker_result r ON (r.testcaseid = t.id AND r.buildid = b.id)
93+JOIN qatracker_bug g ON g.resultid = r.id
94+JOIN qatracker_launchpad_bug l ON g.bugnumber = l.originalbug
95+WHERE m.siteid = :siteid
96+AND SUBSTRING(m.title, '^[^ ]+') IN (
97+ SELECT DISTINCT SUBSTRING(m2.title, '^[^ ]+')
98+ FROM qatracker_milestone m2
99+ WHERE m2.status IN (0,1)
100+ AND m2.siteid = m.siteid
101+)
102+AND tt.status IN (0, 2)
103+ORDER by m.id DESC, importance_order, l.status", array(":siteid" => intval($siteid)));
104+
105+ return $result->fetchAll();
106 }
107
108
109@@ -135,17 +122,17 @@
110
111 $header = array(
112 array('data' => 'Bug #'),
113- array('data' => 'Title', 'field' => 'btitle', 'sort' => 'DESC'),
114- array('data' => 'Affects', 'field' => 'l.product', 'sort' => 'DESC'),
115- array('data' => 'Status', 'field' => 'l.status', 'sort' => 'DESC'),
116- array('data' => 'Importance', 'field' => 'l.importance', 'sort' => 'DESC'),
117- array('data' => 'Assignee', 'field' => 'l.assignee', 'sort' => 'DESC'),
118- array('data' => 'Com.', 'field' => 'l.commentscount', 'sort' => 'DESC'),
119- array('data' => 'Sub.', 'field' => 'l.subscriberscount', 'sort' => 'DESC'),
120- array('data' => 'Dup.', 'field' => 'l.duplicatescount', 'sort' => 'DESC'),
121+ array('data' => 'Title'),
122+ array('data' => 'Affects'),
123+ array('data' => 'Status'),
124+ array('data' => 'Importance'),
125+ array('data' => 'Assignee'),
126+ array('data' => 'Com.'),
127+ array('data' => 'Sub.'),
128+ array('data' => 'Dup.'),
129 );
130
131- $bugs = qatracker_getbugs_for_release($siteid, $header);
132+ $bugs = qatracker_getbugs_for_release($siteid);
133
134 $curr_milestone = "";
135 $rows = array();

Subscribers

People subscribed via source and target branches