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
=== modified file 'modules/qatracker/user/qatracker.user.results.php'
--- modules/qatracker/user/qatracker.user.results.php 2015-12-16 21:56:07 +0000
+++ modules/qatracker/user/qatracker.user.results.php 2015-12-24 02:48:52 +0000
@@ -533,16 +533,7 @@
533 $bugs = t("None");533 $bugs = t("None");
534 }534 }
535535
536 $form['old_bugs'] = array(536 $form['old bugs'] = create_bug_table();
537 '#type' => 'fieldset',
538 '#title' => 'Bugs',
539 );
540 $form['old_bugs'][] = array(
541 '#type' => 'markup',
542 '#prefix' => '<h2>'.t("Bugs to look for").'</h2>',
543 '#markup' => $bugs,
544 '#suffix' => '<br /><small>'.t('List of bugs that were previously reported for this testcase.').'</small>',
545 );
546537
547 if ($user_result) {538 if ($user_result) {
548 $form['qatracker_result'] = array(539 $form['qatracker_result'] = array(
@@ -783,4 +774,81 @@
783 return $form;774 return $form;
784}775}
785776
777function create_bug_table() {
778 $milestoneid=arg(2);
779 $testcaseid=arg(6);
780
781 $header = array(
782 array('data' => t('Bug #'), 'style' => 'width:5em;text-align:center'),
783 array('data' => t('Title'), 'style' => 'width:auto;text-align:left'),
784 array('data' => t('Status'), 'field' => 'status', 'style' => 'width:4em;text-align:center', 'sort' => 'DESC'),
785 array('data' => t('Importance'), 'field' => 'importance', 'style' => 'width:4em;text-align:center', 'sort' => 'DESC'),
786 array('data' => t('Assignee'), 'style' => 'width:4em;text-align:center'),
787 array('data' => t('Product'), 'style' => 'width:6em;text-align:left')
788 );
789
790 # Get bugs stats (FIXME: copy/paste from qatracker_build_stats, should be moved to separate function)
791 $query = db_select('qatracker_launchpad_bug')
792 ->extend('TableSort')
793 ->extend('PagerDefault');
794 $query->fields('qatracker_launchpad_bug', array(
795 'bugnumber',
796 'title',
797 'product',
798 'status',
799 'importance',
800 'assignee',
801 'commentscount',
802 'duplicatescount',
803 'subscriberscount',
804 'lastchange'
805 ));
806 $query->addField('qatracker_bug', 'bugnumber', 'originalbug');
807 $query->addExpression('COUNT(qatracker_bug.bugnumber)', 'reportedcount');
808 $query->addExpression('MAX(qatracker_bug.bugimportance)', 'maximportance');
809 $query->rightjoin('qatracker_bug', 'qatracker_bug', 'qatracker_bug.bugnumber = qatracker_launchpad_bug.originalbug');
810 $query->leftjoin('qatracker_result', 'qatracker_result', 'qatracker_result.id = qatracker_bug.resultid');
811 $query->leftjoin('qatracker_build', 'qatracker_build', 'qatracker_build.id = qatracker_result.buildid');
812 $query->leftjoin('qatracker_build_milestone', 'qatracker_build_milestone', 'qatracker_build_milestone.buildid = qatracker_result.buildid');
813 $query->groupBy('
814 qatracker_bug.bugnumber,
815 qatracker_launchpad_bug.bugnumber,
816 qatracker_launchpad_bug.title,
817 qatracker_launchpad_bug.product,
818 qatracker_launchpad_bug.status,
819 qatracker_launchpad_bug.importance,
820 qatracker_launchpad_bug.assignee,
821 qatracker_launchpad_bug.commentscount,
822 qatracker_launchpad_bug.duplicatescount,
823 qatracker_launchpad_bug.subscriberscount,
824 qatracker_launchpad_bug.lastchange'
825 );
826 $query->condition('qatracker_build_milestone.milestoneid', $milestoneid);
827 $query->condition('qatracker_result.testcaseid', $testcaseid);
828 $query->orderByHeader($header);
829
830 $bugs = $query->execute()->fetchAll();
831
832 $rows = array();
833 foreach ($bugs as $bug) {
834 if (!empty($bug->bugnumber)) {
835 $rows[] = array(
836 '<a href="http://launchpad.net/bugs/'.$bug->bugnumber.'">'.$bug->bugnumber.'</a>',
837 $bug->title,
838 $bug->status,
839 $bug->importance,
840 $bug->assignee,
841 $bug->product
842 );
843 }
844 }
845
846 return array(
847 '#theme' => "table",
848 '#header' => $header,
849 '#rows' => $rows,
850 '#prefix' => '<h2>'.t("Bugs to look for").'</h2>'
851 );
852}
853
786?>854?>

Subscribers

People subscribed via source and target branches