From a02c74d830733a388975b4dca34d2b63ac160543 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 21 Mar 2018 16:01:46 +0000 Subject: [PATCH] customer stats test fixed --- .../Schema/Result/ViewQuantisedTransactionSQLite.pm | 2 +- t/api/stats.t | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionSQLite.pm b/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionSQLite.pm index abf95dd..1c908fd 100644 --- a/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionSQLite.pm +++ b/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionSQLite.pm @@ -17,7 +17,7 @@ SELECT "value", "seller_id", DATETIME(STRFTIME('%Y-%m-%d %H:00:00',"purchase_time")) AS "quantised_hours", DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time")) AS "quantised_days", - DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time", 'weekday 1')) AS "quantised_weeks" + DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"purchase_time",'weekday 0','-6 days')) AS "quantised_weeks" FROM "transactions" /); diff --git a/t/api/stats.t b/t/api/stats.t index 67e8705..2fa8a9a 100644 --- a/t/api/stats.t +++ b/t/api/stats.t @@ -49,11 +49,11 @@ $t->post_ok('/api/stats/customer' => json => { }) ->status_is(200)->or($framework->dump_error) ->json_is('/weeks', { - first => 2, - second => 21, + first => 20, + second => 20, max => 22, sum => 118, - count => 7, + count => 6, }) ->or($framework->dump_error) ->json_is('/sectors', {