From 12bd6b3ec961052e478df1441f3e076bf20684ab Mon Sep 17 00:00:00 2001 From: Finn Date: Thu, 14 Dec 2017 17:25:00 +0000 Subject: [PATCH] org graphs and relevant test fixed --- lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm | 4 ++-- t/api/v1/organisation/graphs.t | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm b/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm index 5ce5f44..a6f56eb 100644 --- a/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm +++ b/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm @@ -127,10 +127,10 @@ sub _sales_last_duration { my ( $start, $end ) = $c->_get_start_end_duration( $duration ); - $data->{bounds} = ( + $data->{bounds} = { min => $c->format_iso_datetime( $start ), max => $c->format_iso_datetime( $end ), - ); + }; while ( $start < $end ) { my $next_end = $start->clone->add( days => 1 ); diff --git a/t/api/v1/organisation/graphs.t b/t/api/v1/organisation/graphs.t index 5fd0da7..3e438b4 100644 --- a/t/api/v1/organisation/graphs.t +++ b/t/api/v1/organisation/graphs.t @@ -64,7 +64,7 @@ $t->post_ok('/api/v1/organisation/graphs' => json => { $start->clone->subtract( days => $_ )->subtract( hours => 12 ) ) } reverse ( 0 .. 29 ) ], bounds => { - min => $t->app->format_iso_datetime($start->clone->subtract( days => 6 )->subtract( hours => 12 ) ), + min => $t->app->format_iso_datetime($start->clone->subtract( days => 29 )->subtract( hours => 12 ) ), max => $t->app->format_iso_datetime($start->clone->add( hours => 12 )), }, data => [ 4, 2, 3, 3, 4, 1, 4, 3, 3, 2, 4, 2, 4, 2, 3, 3, 4, 1, 4, 3, 3, 2, 4, 2, 4, 2, 3, 3, 4, 1 ], @@ -96,7 +96,7 @@ $t->post_ok('/api/v1/organisation/graphs' => json => { $start->clone->subtract( days => $_ )->subtract( hours => 12 ) ) } reverse ( 0 .. 29 ) ], bounds => { - min => $t->app->format_iso_datetime($start->clone->subtract( days => 6 )->subtract( hours => 12 ) ), + min => $t->app->format_iso_datetime($start->clone->subtract( days => 29 )->subtract( hours => 12 ) ), max => $t->app->format_iso_datetime($start->clone->add( hours => 12 )), }, data => [ 40, 20, 30, 30, 40, 10, 40, 30, 30, 20, 40, 20, 40, 20, 30, 30, 40, 10, 40, 30, 30, 20, 40, 20, 40, 20, 30, 30, 40, 10 ],