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

Proposed by Hunter
Status: Merged
Merged at revision: 411
Proposed branch: lp:~hjarrell555/ubuntu-qa-website/bug_1366581
Merge into: lp:ubuntu-qa-website
Diff against target: 103 lines (+78/-10)
1 file modified
modules/qatracker/user/qatracker.user.results.php (+78/-10)
To merge this branch: bzr merge lp:~hjarrell555/ubuntu-qa-website/bug_1366581
Reviewer Review Type Date Requested Status
Nicholas Skaggs (community) Needs Information
Review via email: mp+281334@code.launchpad.net

Description of the change

Changed the list of previous bugs on user results page to a table of bugs to better see the information related to the bugs.

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

I get issues with running this on my install:

Warning: Creating default object from empty value in qatracker_user_results_form() (line 541 of /usr/share/drupal7/modules/qatracker/user/qatracker.user.results.php).

Are you running into this Hunter?

review: Needs Information
Revision history for this message
Hunter (hjarrell555) wrote :

I've had this since I started GCI. I reverted to a revision before my code and I think the issue is still there.

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

Gotcha, this is part of the production deploy happening today. Hunter, where you able to load a production snapshot on your local instance? If so, might be useful to update the wiki with how exactly you did so.

Revision history for this message
Hunter (hjarrell555) wrote :

I only restored the one table but I'd be happy to show how I did it. What page did you have in mind to add it to or did you mean on a new page?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/qatracker/user/qatracker.user.results.php'
2--- modules/qatracker/user/qatracker.user.results.php 2015-12-16 21:56:07 +0000
3+++ modules/qatracker/user/qatracker.user.results.php 2015-12-24 02:48:52 +0000
4@@ -533,16 +533,7 @@
5 $bugs = t("None");
6 }
7
8- $form['old_bugs'] = array(
9- '#type' => 'fieldset',
10- '#title' => 'Bugs',
11- );
12- $form['old_bugs'][] = array(
13- '#type' => 'markup',
14- '#prefix' => '<h2>'.t("Bugs to look for").'</h2>',
15- '#markup' => $bugs,
16- '#suffix' => '<br /><small>'.t('List of bugs that were previously reported for this testcase.').'</small>',
17- );
18+ $form['old bugs'] = create_bug_table();
19
20 if ($user_result) {
21 $form['qatracker_result'] = array(
22@@ -783,4 +774,81 @@
23 return $form;
24 }
25
26+function create_bug_table() {
27+ $milestoneid=arg(2);
28+ $testcaseid=arg(6);
29+
30+ $header = array(
31+ array('data' => t('Bug #'), 'style' => 'width:5em;text-align:center'),
32+ array('data' => t('Title'), 'style' => 'width:auto;text-align:left'),
33+ array('data' => t('Status'), 'field' => 'status', 'style' => 'width:4em;text-align:center', 'sort' => 'DESC'),
34+ array('data' => t('Importance'), 'field' => 'importance', 'style' => 'width:4em;text-align:center', 'sort' => 'DESC'),
35+ array('data' => t('Assignee'), 'style' => 'width:4em;text-align:center'),
36+ array('data' => t('Product'), 'style' => 'width:6em;text-align:left')
37+ );
38+
39+ # Get bugs stats (FIXME: copy/paste from qatracker_build_stats, should be moved to separate function)
40+ $query = db_select('qatracker_launchpad_bug')
41+ ->extend('TableSort')
42+ ->extend('PagerDefault');
43+ $query->fields('qatracker_launchpad_bug', array(
44+ 'bugnumber',
45+ 'title',
46+ 'product',
47+ 'status',
48+ 'importance',
49+ 'assignee',
50+ 'commentscount',
51+ 'duplicatescount',
52+ 'subscriberscount',
53+ 'lastchange'
54+ ));
55+ $query->addField('qatracker_bug', 'bugnumber', 'originalbug');
56+ $query->addExpression('COUNT(qatracker_bug.bugnumber)', 'reportedcount');
57+ $query->addExpression('MAX(qatracker_bug.bugimportance)', 'maximportance');
58+ $query->rightjoin('qatracker_bug', 'qatracker_bug', 'qatracker_bug.bugnumber = qatracker_launchpad_bug.originalbug');
59+ $query->leftjoin('qatracker_result', 'qatracker_result', 'qatracker_result.id = qatracker_bug.resultid');
60+ $query->leftjoin('qatracker_build', 'qatracker_build', 'qatracker_build.id = qatracker_result.buildid');
61+ $query->leftjoin('qatracker_build_milestone', 'qatracker_build_milestone', 'qatracker_build_milestone.buildid = qatracker_result.buildid');
62+ $query->groupBy('
63+ qatracker_bug.bugnumber,
64+ qatracker_launchpad_bug.bugnumber,
65+ qatracker_launchpad_bug.title,
66+ qatracker_launchpad_bug.product,
67+ qatracker_launchpad_bug.status,
68+ qatracker_launchpad_bug.importance,
69+ qatracker_launchpad_bug.assignee,
70+ qatracker_launchpad_bug.commentscount,
71+ qatracker_launchpad_bug.duplicatescount,
72+ qatracker_launchpad_bug.subscriberscount,
73+ qatracker_launchpad_bug.lastchange'
74+ );
75+ $query->condition('qatracker_build_milestone.milestoneid', $milestoneid);
76+ $query->condition('qatracker_result.testcaseid', $testcaseid);
77+ $query->orderByHeader($header);
78+
79+ $bugs = $query->execute()->fetchAll();
80+
81+ $rows = array();
82+ foreach ($bugs as $bug) {
83+ if (!empty($bug->bugnumber)) {
84+ $rows[] = array(
85+ '<a href="http://launchpad.net/bugs/'.$bug->bugnumber.'">'.$bug->bugnumber.'</a>',
86+ $bug->title,
87+ $bug->status,
88+ $bug->importance,
89+ $bug->assignee,
90+ $bug->product
91+ );
92+ }
93+ }
94+
95+ return array(
96+ '#theme' => "table",
97+ '#header' => $header,
98+ '#rows' => $rows,
99+ '#prefix' => '<h2>'.t("Bugs to look for").'</h2>'
100+ );
101+}
102+
103 ?>

Subscribers

People subscribed via source and target branches