Merge lp:~hjarrell555/ubuntu-qa-website/bug_1366579 into lp:ubuntu-qa-website

Proposed by Hunter
Status: Merged
Merged at revision: 415
Proposed branch: lp:~hjarrell555/ubuntu-qa-website/bug_1366579
Merge into: lp:ubuntu-qa-website
Diff against target: 135 lines (+60/-47)
1 file modified
modules/qatracker/report/qatracker.report.defects.php (+60/-47)
To merge this branch: bzr merge lp:~hjarrell555/ubuntu-qa-website/bug_1366579
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) Approve
Review via email: mp+281817@code.launchpad.net

Description of the change

Changed the defects report to add sorting to status and importance columns.

To post a comment you must log in.
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Hunter, I see status and importance are sortable; do you think we could make any field sortable? Should be a trivial enough tweak yes?

I'm having trouble testing this on my local install, so I'll take your word for it that it's tests out a-ok.

Revision history for this message
Nicholas Skaggs (nskaggs) :
review: Needs Information
Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Also Hunter, it would be useful if you could writeup / script up using that production db dump on a new instance of the qatracker. Perhaps expand the script to do it? I wiped my old install, and now I'm having trouble recreating what I had you do, hah!

Revision history for this message
Hunter (hjarrell555) wrote :

I only restored the qatracker_launchpad_bug table but I could expand it to the other tables too if you wanted. While I'm at school the command I used was: pg_restore --data-only --table=qatracker_launchpad_bug <datadump> > bugs.pg

Then psql -f bug.pg

I then just created test milestones and series and products like the isodev setup guide and added bug numbers pulled from SELECT bugnumber FROM qatracker_launchpad_bug;

Revision history for this message
Hunter (hjarrell555) wrote :

I only restored the qatracker_launchpad_bug table but I could expand it to the other tables too if you wanted. While I'm at school the command I used was: pg_restore --data-only --table=qatracker_launchpad_bug <datadump> > bugs.pg

Then psql -f bug.pg

I then just created test milestones and series and products like the isodev setup guide and added bug numbers pulled from SELECT bugnumber FROM qatracker_launchpad_bug;

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Ahh, you only restored the specific table. That sounds like a good idea. The full restore doesn't work out so well.

Revision history for this message
Hunter (hjarrell555) wrote :

Yeah when I tried a restore of just the full dumo I broke my install.

Revision history for this message
Hunter (hjarrell555) wrote :

Yeah any table can be sorted the change only has to be done on the header. It just needs a field value with the database field that column represents and a default sort order. Ex:

$header = array(
array('data' => 'Column Name', 'field' => 'databasefield', 'sort' => 'ASC')
);

Also about the database restore I forgot that last night I was going to use the pg_restore to restore just the data from all the qatracker tables and I left it about 20min and it still wasn't finished, so I canceled it.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

Hunter, yes, I would just add the sorting for all fields to the header. With that, this has my approval.

416. By Hunter

Added sortability to all columns except bugnumber for defects report

Revision history for this message
Hunter (hjarrell555) wrote :

The only issue is that I couldn't get the bug number to sort. I was getting an error with the tablesort module for the Bug # column.

Revision history for this message
Nicholas Skaggs (nskaggs) wrote :

LGTM, I will confirm in testing tomorrow.

Revision history for this message
Nicholas Skaggs (nskaggs) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'modules/qatracker/report/qatracker.report.defects.php'
--- modules/qatracker/report/qatracker.report.defects.php 2012-11-06 21:45:44 +0000
+++ modules/qatracker/report/qatracker.report.defects.php 2016-01-09 00:57:52 +0000
@@ -45,53 +45,66 @@
45 return $content;45 return $content;
46}46}
4747
48function qatracker_getbugs_for_release($siteid) {48function qatracker_getbugs_for_release($siteid, $header) {
49 /* 49 /*
50 * Get all the bugs for all the milestones of a release 50 * Get all the bugs for all the milestones of a release
51 * for a given siteid 51 * for a given siteid
52 */52 */
5353 $query = db_select('qatracker_build', 'b')
54 $result = db_query("54 ->extend('TableSort')
55SELECT DISTINCT m.title mtitle55 ->extend('PagerDefault');
56 ,l.bugnumber56 $query->distinct();
57 ,l.product57 $query->addField('m', 'title', 'mtitle');
58 ,l.title btitle58 $query->fields('l', array(
59 ,l.status59 'bugnumber',
60 ,l.importance 60 'product',
61 ,l.assignee61 'title'));
62 ,l.commentscount62 $query->addField('l', 'title', 'btitle');
63 ,l.duplicatescount63 $query->fields('l', array(
64 ,l.subscriberscount64 'status',
65 ,m.id65 'importance',
66 ,(CASE 66 'assignee',
67 'commentscount',
68 'duplicatescount',
69 'subscriberscount'
70 ));
71 $query->addField('m', 'id');
72 $query->addExpression("CASE
67 WHEN l.importance = 'Critical' THEN 073 WHEN l.importance = 'Critical' THEN 0
68 WHEN l.importance = 'High' THEN 174 WHEN l.importance = 'High' THEN 1
69 WHEN l.importance = 'Medium' THEN 275 WHEN l.importance = 'Medium' THEN 2
70 WHEN l.importance = 'Low' THEN 376 WHEN l.importance = 'Low' THEN 3
71 WHEN l.importance = 'Undecided' THEN 1077 WHEN l.importance = 'Undecided' THEN 10
72 ELSE 5 END78 ELSE 5 END", 'importance_order');
73 ) importance_order79 $query->join('qatracker_product', 'p', 'p.id = b.productid');
74FROM qatracker_build b80 $query->join('qatracker_build_milestone', 'bm', 'bm.buildid = b.id');
75JOIN qatracker_product p ON p.id = b.productid81 $query->join('qatracker_milestone', 'm', 'bm.milestoneid = m.id');
76JOIN qatracker_build_milestone bm ON bm.buildid = b.id82 $query->join('qatracker_testsuite_product', 'tp', 'tp.productid = b.productid AND tp.milestone_seriesid = m.seriesid');
77JOIN qatracker_milestone m ON bm.milestoneid = m.id83 $query->join('qatracker_testsuite_testcase', 'tt', 'tt.testsuiteid = tp.testsuiteid');
78JOIN qatracker_testsuite_product tp ON tp.productid = b.productid AND tp.milestone_seriesid = m.seriesid84 $query->join('qatracker_testcase', 't', 'tt.testcaseid = t.id');
79JOIN qatracker_testsuite_testcase tt ON tt.testsuiteid = tp.testsuiteid85 $query->join('qatracker_result', 'r', '(r.testcaseid = t.id AND r.buildid = b.id)');
80JOIN qatracker_testcase t ON tt.testcaseid = t.id86 $query->join('qatracker_bug', 'g', 'g.resultid = r.id');
81JOIN qatracker_result r ON (r.testcaseid = t.id AND r.buildid = b.id)87 $query->join('qatracker_launchpad_bug', 'l', 'g.bugnumber = l.originalbug');
82JOIN qatracker_bug g ON g.resultid = r.id88 $query->condition('m.siteid', intval($siteid));
83JOIN qatracker_launchpad_bug l ON g.bugnumber = l.originalbug89
84WHERE m.siteid = :siteid90 $subquery = db_select('qatracker_milestone', 'm2');
85AND SUBSTRING(m.title, '^[^ ]+') IN (91 $subquery->distinct();
86 SELECT DISTINCT SUBSTRING(m2.title, '^[^ ]+') 92 $subquery->addExpression("SUBSTRING(m2.title, '^[^ ]+')");
87 FROM qatracker_milestone m293 $or = db_or();
88 WHERE m2.status IN (0,1)94 $or->condition('m2.status', 0, '=');
89 AND m2.siteid = m.siteid95 $or->condition('m2.status', 1, '=');
90)96 $subquery->condition($or);
91AND tt.status IN (0, 2)97 $subquery->condition('m2.siteid', 'm.siteid');
92ORDER by m.id DESC, importance_order, l.status", array(":siteid" => intval($siteid)));98
9399 $query->addExpression("SUBSTRING(m.title, '^[^ ]+') IN (" . $subquery->__toString() . ')');
94 return $result->fetchAll();100 $or = db_or();
101 $or->condition('tt.status', 0, '=');
102 $or->condition('tt.status', 2, '=');
103 $query->condition($or);
104 $query->condition('tt.status', array(0, 2), 'IN');
105 $query->orderBy('m.id', 'DESC');
106 $query->orderByHeader($header);
107 return $query->execute()->fetchAll();
95}108}
96109
97110
@@ -122,17 +135,17 @@
122135
123 $header = array(136 $header = array(
124 array('data' => 'Bug #'),137 array('data' => 'Bug #'),
125 array('data' => 'Title'),138 array('data' => 'Title', 'field' => 'btitle', 'sort' => 'DESC'),
126 array('data' => 'Affects'),139 array('data' => 'Affects', 'field' => 'l.product', 'sort' => 'DESC'),
127 array('data' => 'Status'),140 array('data' => 'Status', 'field' => 'l.status', 'sort' => 'DESC'),
128 array('data' => 'Importance'),141 array('data' => 'Importance', 'field' => 'l.importance', 'sort' => 'DESC'),
129 array('data' => 'Assignee'),142 array('data' => 'Assignee', 'field' => 'l.assignee', 'sort' => 'DESC'),
130 array('data' => 'Com.'),143 array('data' => 'Com.', 'field' => 'l.commentscount', 'sort' => 'DESC'),
131 array('data' => 'Sub.'),144 array('data' => 'Sub.', 'field' => 'l.subscriberscount', 'sort' => 'DESC'),
132 array('data' => 'Dup.'),145 array('data' => 'Dup.', 'field' => 'l.duplicatescount', 'sort' => 'DESC'),
133 );146 );
134147
135 $bugs = qatracker_getbugs_for_release($siteid);148 $bugs = qatracker_getbugs_for_release($siteid, $header);
136149
137 $curr_milestone = "";150 $curr_milestone = "";
138 $rows = array();151 $rows = array();

Subscribers

People subscribed via source and target branches