added month listing

This commit is contained in:
Finn 2018-04-11 19:10:19 +01:00
parent bc92d2eb11
commit 78fdfc1e1d

View file

@ -6,7 +6,7 @@ sub index {
my $entity = $c->stash->{api_user}->entity; 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; my $purchase_rs = $entity->purchases;
@ -98,6 +98,7 @@ sub index {
my $days = $c->format_iso_date( $quantised ) || 0; my $days = $c->format_iso_date( $quantised ) || 0;
my $category = $cat_trans->get_column('category_id') || 0; my $category = $cat_trans->get_column('category_id') || 0;
my $value = ($cat_trans->get_column('value') || 0) / 100000; my $value = ($cat_trans->get_column('value') || 0) / 100000;
$data->{cat_total}->{$category_list->{$category}} += $value;
$data->{categories}->{$days}->{$category_list->{$category}} += $value; $data->{categories}->{$days}->{$category_list->{$category}} += $value;
next unless $cat_trans->get_column('essential'); next unless $cat_trans->get_column('essential');
$data->{essentials}->{$days}->{value} += $value; $data->{essentials}->{$days}->{value} += $value;