From 4ba6a443fca484dfffa8392ebbb8487a1562e37c Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Mon, 4 Sep 2017 17:39:48 +0100 Subject: [PATCH] Stop null values on org graphs --- lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm b/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm index 07b952b..5b4eab5 100644 --- a/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm +++ b/lib/Pear/LocalLoop/Controller/Api/V1/Organisation/Graphs.pm @@ -102,7 +102,7 @@ sub _sales_last_duration { my $transactions = $entity->sales ->search_between( $start, $next_end ) ->get_column('value') - ->sum; + ->sum || 0; push @{ $data->{ labels } }, $start->day_name; push @{ $data->{ data } }, $transactions; $start->add( days => 1 ); @@ -134,7 +134,7 @@ sub _purchases_last_duration { my $transactions = $entity->purchases ->search_between( $start, $next_end ) ->get_column('value') - ->sum; + ->sum || 0; push @{ $data->{ labels } }, $start->day_name; push @{ $data->{ data } }, $transactions; $start->add( days => 1 );