diff --git a/lib/Pear/LocalLoop/Controller/Api/Categories.pm b/lib/Pear/LocalLoop/Controller/Api/Categories.pm index 0509581..653b2e6 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Categories.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Categories.pm @@ -3,15 +3,6 @@ use Mojo::Base 'Mojolicious::Controller'; use List::Util qw/ max sum /; -has error_messages => sub { - return { - type => { - required => { message => 'Type of Leaderboard Required', status => 400 }, - in_resultset => { message => 'Unrecognised Leaderboard Type', status => 400 }, - }, - }; -}; - sub post_category_list { my $c = shift; @@ -47,7 +38,7 @@ sub post_category_list { } ); - for ( $transaction_rs->all ) { + for ( $month_transaction_rs->all ) { my $quantised = $c->db_datetime_parser->parse_datetime($_->get_column('quantised')); push @{ $data->{ days } }, ($c->format_iso_datetime( $quantised ) || 0); push @{ $data->{ category } }, ($_->get_column('category_id') || 0); diff --git a/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionCategorySQLite.pm b/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionCategorySQLite.pm index 0b68497..27e4ab7 100644 --- a/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionCategorySQLite.pm +++ b/lib/Pear/LocalLoop/Schema/Result/ViewQuantisedTransactionCategorySQLite.pm @@ -10,15 +10,15 @@ __PACKAGE__->table('view_quantised_transactions'); __PACKAGE__->result_source_instance->is_virtual(1); __PACKAGE__->result_source_instance->view_definition( qq/ -SELECT "value", - "distance", - "purchase_time", - "buyer_id", - "seller_id", +SELECT "transactions.value", + "transactions.distance", + "transactions.purchase_time", + "transactions.buyer_id", + "transactions.seller_id", "transaction_category.category_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 %H:00:00',"transactions.purchase_time")) AS "quantised_hours", + DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"transactions.purchase_time")) AS "quantised_days", + DATETIME(STRFTIME('%Y-%m-%d 00:00:00',"transactions.purchase_time", 'weekday 1')) AS "quantised_weeks" FROM "transactions" LEFT JOIN "transaction_category" ON "transactions.id" = "transaction_category.transaction_id" /);