[bugzilla-gnome-org-extensions] Further speed up trace.html by taking advantage of bug_link's ability to take a Bugzilla::Bug and by
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Further speed up trace.html by taking advantage of bug_link's ability to take a Bugzilla::Bug and by
- Date: Thu, 20 Nov 2014 22:13:21 +0000 (UTC)
commit 2300c1dd5a6b8d094cc47b34c1e2e75154297cb6
Author: Max Kanat-Alexander <mkanat everythingsolved com>
Date: Thu Aug 6 01:31:57 2009 -0500
Further speed up trace.html by taking advantage of bug_link's ability to
take a Bugzilla::Bug and by pre-populating the "product" member of each
displayed trace's bug.
lib/TraceParser/Trace.pm | 11 +++++++++++
template/en/default/pages/trace.html.tmpl | 2 +-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/lib/TraceParser/Trace.pm b/lib/TraceParser/Trace.pm
index f8a8ff1..3b1294e 100644
--- a/lib/TraceParser/Trace.pm
+++ b/lib/TraceParser/Trace.pm
@@ -99,9 +99,20 @@ sub _do_list_select {
WHERE id IN(' . join(',', @trace_ids) . ')', {Columns=>[1,2]}) };
my %unique_ids = map { $bug_ids{$_} => 1 } (keys %bug_ids);
my $bugs = Bugzilla::Bug->new_from_list([values %bug_ids]);
+
+ # Populate "product" for each bug.
+ my %product_ids = map { $_->{product_id} => 1 } @$bugs;
+ my %products = @{ $dbh->selectcol_arrayref(
+ 'SELECT id, name FROM products WHERE id IN('
+ . join(',', values %product_ids) . ')', {Columns=>[1,2]}) };
+ foreach my $bug (@$bugs) {
+ $bug->{product} = $products{$bug->{product_id}};
+ }
+
# Pre-initialize the can_see_bug cache for these bugs.
Bugzilla->user->visible_bugs($bugs);
my %bug_map = map { $_->id => $_ } @$bugs;
+
# And add them to each trace object.
foreach my $trace (@$objects) {
my $bug_id = $bug_ids{$trace->id};
diff --git a/template/en/default/pages/trace.html.tmpl b/template/en/default/pages/trace.html.tmpl
index f0a7e47..5ec60e3 100644
--- a/template/en/default/pages/trace.html.tmpl
+++ b/template/en/default/pages/trace.html.tmpl
@@ -47,7 +47,7 @@
<a href="page.cgi?id=trace.html&trace_id=
[%- this_trace.id FILTER url_quote %]">Trace
[% this_trace.id FILTER html %]</a> on
- [%+ "Bug $bug.id" FILTER bug_link(bug.id) %]:
+ [%+ "Bug $bug.id" FILTER bug_link(bug) %]:
[% bug.bug_status FILTER html %] [%+ bug.resolution FILTER html %]
[% IF bug.dup_id %]
of [% "bug $bug.dup_id" FILTER bug_link(bug.dup_id) %]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]