From 8aacc32c71c22cbedd57f27a0455e088166aebe6 Mon Sep 17 00:00:00 2001 From: Finn Date: Fri, 2 Mar 2018 17:33:57 +0000 Subject: [PATCH] Fixed code to ensure tests passed --- lib/Pear/LocalLoop/Controller/Api/Categories.pm | 2 +- lib/Pear/LocalLoop/Controller/Api/Upload.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/Categories.pm b/lib/Pear/LocalLoop/Controller/Api/Categories.pm index 9569168..9913f42 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Categories.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Categories.pm @@ -55,7 +55,7 @@ sub post_category_list { $data->{essentials}->{$days}->{value} += $value; } - for my $day ( keys $data->{categories} ) { + for my $day ( keys %{ $data->{categories} } ) { $data->{categories}->{$day} = [ sort { $b->{value} <=> $a->{value} } @{ $data->{categories}->{$day} } ]; } diff --git a/lib/Pear/LocalLoop/Controller/Api/Upload.pm b/lib/Pear/LocalLoop/Controller/Api/Upload.pm index 787be33..d1a0bd2 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Upload.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Upload.pm @@ -196,7 +196,7 @@ sub post_upload { ( defined $file ? ( proof_image => $file ) : () ), purchase_time => $c->format_db_datetime($purchase_time), distance => $distance, - essential => ( defined $essential ? $essential : undef ), + essential => ( defined $essential ? $essential : 0 ), } );