From 78fdfc1e1d14207ba61d36fedfc3f8360fe311c1 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 11 Apr 2018 19:10:19 +0100 Subject: [PATCH] added month listing --- lib/Pear/LocalLoop/Controller/Api/V1/Customer/Pies.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/V1/Customer/Pies.pm b/lib/Pear/LocalLoop/Controller/Api/V1/Customer/Pies.pm index 8a1210f..2ae26cb 100644 --- a/lib/Pear/LocalLoop/Controller/Api/V1/Customer/Pies.pm +++ b/lib/Pear/LocalLoop/Controller/Api/V1/Customer/Pies.pm @@ -6,7 +6,7 @@ sub index { my $entity = $c->stash->{api_user}->entity; - my $data = { local_all => {}, categories => {}, essentials => {} }; + my $data = { local_all => {}, cat_total => {}, categories => {}, essentials => {} }; my $purchase_rs = $entity->purchases; @@ -98,6 +98,7 @@ sub index { my $days = $c->format_iso_date( $quantised ) || 0; my $category = $cat_trans->get_column('category_id') || 0; my $value = ($cat_trans->get_column('value') || 0) / 100000; + $data->{cat_total}->{$category_list->{$category}} += $value; $data->{categories}->{$days}->{$category_list->{$category}} += $value; next unless $cat_trans->get_column('essential'); $data->{essentials}->{$days}->{value} += $value;