[bugzilla-gnome-org-extensions] Re-work the by-product-sorting code in TraceParser::Hooks.
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Re-work the by-product-sorting code in TraceParser::Hooks.
- Date: Thu, 20 Nov 2014 22:13:41 +0000 (UTC)
commit 88ef3583af486c5e4d4fc639ce574d71d1f8c53a
Author: Max Kanat-Alexander <mkanat everythingsolved com>
Date: Thu Aug 6 04:25:21 2009 -0500
Re-work the by-product-sorting code in TraceParser::Hooks.
lib/TraceParser/Hooks.pm | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
---
diff --git a/lib/TraceParser/Hooks.pm b/lib/TraceParser/Hooks.pm
index 7356aad..80f149c 100644
--- a/lib/TraceParser/Hooks.pm
+++ b/lib/TraceParser/Hooks.pm
@@ -140,19 +140,22 @@ sub _page_trace {
# Remove this trace from the identical traces.
@$identical_traces = grep { $_->id != $trace->id } @$identical_traces;
- my (%similar, %identical);
- foreach my $trace (@$similar_traces) {
- my $product = $trace->bug->product;
- $similar{$product} ||= [];
- push(@{ $similar{$product} }, $trace);
+ my %ungrouped = ( identical => $identical_traces,
+ similar => $similar_traces );
+ my %by_product = ( identical => {}, similar => {} );
+
+ foreach my $type (qw(identical similar)) {
+ my $traces = $ungrouped{$type};
+ my $grouped = $by_product{$type};
+ foreach my $trace (@$traces) {
+ my $product = $trace->bug->product;
+ $grouped->{$product} ||= [];
+ push(@{ $grouped->{$product} }, $trace);
+ }
}
- foreach my $trace (@$identical_traces) {
- my $product = $trace->bug->product;
- $identical{$product} ||= [];
- push(@{ $identical{$product} }, $trace);
- }
- $vars->{similar_traces} = \%similar;
- $vars->{identical_traces} = \%identical;
+
+ $vars->{similar_traces} = $by_product{similar};
+ $vars->{identical_traces} = $by_product{identical};
}
$vars->{trace} = $trace;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]