Merge value aggregates on node level
Change-Id: I262df6c5a301bf3ede758bcb0db0e304657c66b9
diff --git a/lib/Krawfish/Koral/Result.pm b/lib/Krawfish/Koral/Result.pm
index 59a0752..9eaa5e9 100644
--- a/lib/Krawfish/Koral/Result.pm
+++ b/lib/Krawfish/Koral/Result.pm
@@ -1,5 +1,6 @@
package Krawfish::Koral::Result;
use Role::Tiny::With;
+use Krawfish::Log;
with 'Krawfish::Koral::Report';
with 'Krawfish::Koral::Result::Inflatable';
use strict;
@@ -15,6 +16,8 @@
# and remove the intermediate compile
# directive!
+use constant DEBUG => 0;
+
# Constructor
sub new {
my $class = shift;
@@ -54,7 +57,11 @@
my $aggregates = $self->{aggregation};
# Check all aggregations
- AGGR: foreach my $new_aggr (@{$result->{aggregation}}) {
+ AGGR: foreach my $new_aggr (@{$result->{aggregation}}) {
+
+ if (DEBUG) {
+ print_log('k_result', 'Merge aggregation data for ' . $new_aggr->key);
+ };
# Merge with existing aggregation
foreach my $est_aggr (@$aggregates) {
@@ -64,10 +71,16 @@
# Merge
$est_aggr->merge($new_aggr);
+
next AGGR;
};
};
+ if (DEBUG) {
+ print_log('k_result', 'Add aggregation data for ' . $new_aggr->key);
+ };
+
+
# Introduce aggregation
$self->add_aggregation($new_aggr);
};
@@ -99,6 +112,10 @@
my ($self, $id) = @_;
my $str = '';
+ if (DEBUG) {
+ print_log('k_result', 'Stringify result');
+ };
+
# Add aggregation
if (@{$self->{aggregation}}) {
$str .= '[aggr=';