From d1757bdac9df743df9ef587d9ec091513644ea9a Mon Sep 17 00:00:00 2001 From: Finn Date: Fri, 15 Sep 2017 11:18:27 +0100 Subject: [PATCH 1/3] Changed routing on submission --- lib/Pear/LocalLoop/Controller/Admin/Organisations.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm index 6921c6a..4fefec3 100644 --- a/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm +++ b/lib/Pear/LocalLoop/Controller/Admin/Organisations.pm @@ -115,7 +115,7 @@ sub valid_edit { $c->flash( success => 'Updated Organisation' ); } }; - $c->redirect_to( '/admin/organisations/' . $valid_org->id ); + $c->redirect_to( '/admin/organisations/'); } 1; From 25511ced69e664a5a759f8bc58d5a12efd770772 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Fri, 15 Sep 2017 12:54:36 +0100 Subject: [PATCH 2/3] Fix calculation mistake on leadearboard display --- lib/Pear/LocalLoop/Controller/Api/Stats.pm | 7 ++++++- t/api/stats_leaderboards.t | 16 ++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/Stats.pm b/lib/Pear/LocalLoop/Controller/Api/Stats.pm index ddb5152..d909fad 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Stats.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Stats.pm @@ -92,7 +92,12 @@ sub post_leaderboards { my @leaderboard_array = $today_values->all; if ( $validation->param('type') =~ /total$/ ) { - map { $_->{value} / 100000 } @leaderboard_array; + @leaderboard_array = (map { + { + %$_, + value => $_->{value} / 100000, + } + } @leaderboard_array); } my $current_user_position = $today_values->find({ entity_id => $c->stash->{api_user}->entity->id }); diff --git a/t/api/stats_leaderboards.t b/t/api/stats_leaderboards.t index 84eb331..95b71b1 100644 --- a/t/api/stats_leaderboards.t +++ b/t/api/stats_leaderboards.t @@ -80,13 +80,13 @@ my $now = DateTime->today(); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 1, + value => 100000, proof_image => 'a', }); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 9, + value => 900000, proof_image => 'a', purchase_time => $dtf->format_datetime($now->clone->subtract( days => 1 )), }); @@ -97,13 +97,13 @@ my $now = DateTime->today(); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 3, + value => 300000, proof_image => 'a', }); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 1, + value => 100000, proof_image => 'a', purchase_time => $dtf->format_datetime($now->clone->subtract( days => 1 )), }); @@ -114,13 +114,13 @@ my $now = DateTime->today(); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 5, + value => 500000, proof_image => 'a', }); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 5, + value => 500000, proof_image => 'a', purchase_time => $dtf->format_datetime($now->clone->subtract( days => 1 )), }); @@ -131,13 +131,13 @@ my $now = DateTime->today(); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 9, + value => 900000, proof_image => 'a', }); $user_result->create_related( 'purchases', { seller_id => $org_result->id, - value => 3, + value => 300000, proof_image => 'a', purchase_time => $dtf->format_datetime($now->clone->subtract( days => 1 )), }); From 9800a6c082caf6f72bf268ff51fde9dbd0c2b995 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Fri, 15 Sep 2017 12:55:41 +0100 Subject: [PATCH 3/3] Update changelog for 0.9.2 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a90e471..a33145a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ # Next Release +# v0.9.2 + +* **Fix:** Leaderboard total calculations not mapped correctly +* **Fix:** Reroute to org list on submission + # v0.9.1 * Change to semantic versioning