fixed critical bugs introduced earlier and changed category viewing

This commit is contained in:
Finn 2018-03-14 19:38:05 +00:00
parent bd36405fa8
commit dfdf4b8104
2 changed files with 14 additions and 9 deletions

View file

@ -198,7 +198,7 @@ sub post_upload {
( defined $file ? ( proof_image => $file ) : () ),
purchase_time => $c->format_db_datetime($purchase_time),
essential => ( defined $essential ? $essential : 0 ),
distance => ( defined $category ? $category : undef ),
distance => $distance,
}
);
@ -227,7 +227,7 @@ sub post_upload {
value => $transaction_value * 100000,
start_time => $c->format_db_datetime($purchase_time),
essential => ( defined $essential ? $essential : 0 ),
distance => ( defined $category ? $category : undef ),
distance => $distance,
category_id => ( defined $category ? $category : undef ),
recurring_period => $recurring_period,
});
@ -243,18 +243,22 @@ sub post_category {
my $c = shift;
my $self = $c;
my $categories = { ids => [], names => [] };
my $category_rs = $c->schema->resultset('Category');
for ( $category_rs->all ) {
push @{ $categories->{ ids } }, $_->get_column('id');
push @{ $categories->{ names } }, $_->get_column('name');
}
# for ( $category_rs->all ) {
# push @{ $categories->{ ids } }, $_->get_column('id');
# push @{ $categories->{ names } }, $_->get_column('name');
# }
my @category_list = (
map {{
id => $_->id,
name => $_->name,
}} $category_rs->all
);
return $self->render( json => {
success => Mojo::JSON->true,
categories => $categories,
categories => \@category_list,
});
}

View file

@ -66,6 +66,7 @@ sub register {
$app->helper( format_iso_datetime => sub {
my ( $c, $datetime_obj ) = @_;
return unless defined $datetime_obj;
return $c->iso_datetime_parser->format_datetime(
$datetime_obj,
);