fixed to category viewing and recurring transaction data
This commit is contained in:
parent
bcb0cd642c
commit
2cf0678126
3 changed files with 8 additions and 9 deletions
|
@ -43,7 +43,7 @@ sub post_category_list {
|
|||
for my $cat_trans ( $month_transaction_category_rs->all ) {
|
||||
my $quantised = $c->db_datetime_parser->parse_datetime($cat_trans->get_column('quantised'));
|
||||
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') || undef;
|
||||
my $value = ($cat_trans->get_column('value') || 0) / 100000;
|
||||
$data->{categories}->{$days} = [] unless exists $data->{categories}->{$days};
|
||||
push @{ $data->{categories}->{$days} }, {
|
||||
|
|
|
@ -42,7 +42,7 @@ sub post_transaction_list_purchases {
|
|||
purchase_time => $c->format_iso_datetime($_->purchase_time),
|
||||
}} $transactions->all
|
||||
);
|
||||
|
||||
|
||||
my @recurring_transaction_list = (
|
||||
map {{
|
||||
id => $_->id,
|
||||
|
@ -51,7 +51,7 @@ sub post_transaction_list_purchases {
|
|||
start_time => $c->format_iso_datetime($_->start_time),
|
||||
last_updated => $c->format_iso_datetime($_->last_updated) || undef,
|
||||
essential => $_->essential,
|
||||
category => $_->category_id,
|
||||
category => $_->category_id || 0,
|
||||
recurring_period => $_->recurring_period,
|
||||
}} $recurring_transactions->all
|
||||
);
|
||||
|
|
|
@ -249,16 +249,15 @@ sub post_category {
|
|||
# push @{ $categories->{ ids } }, $_->get_column('id');
|
||||
# push @{ $categories->{ names } }, $_->get_column('name');
|
||||
# }
|
||||
my @category_list = (
|
||||
map {{
|
||||
id => $_->id,
|
||||
name => $_->name,
|
||||
}} $category_rs->all
|
||||
my %category_list = (
|
||||
map {
|
||||
$_->id => $_->name,
|
||||
} $category_rs->all
|
||||
);
|
||||
|
||||
return $self->render( json => {
|
||||
success => Mojo::JSON->true,
|
||||
categories => \@category_list,
|
||||
categories => \%category_list,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue