From 64fb64385dafd2ed1f364dc7ef6e871610b7cbe5 Mon Sep 17 00:00:00 2001 From: Tom Bloor Date: Mon, 15 Jul 2019 05:34:11 +0100 Subject: [PATCH] And then called them against the right table --- lib/Pear/LocalLoop/Controller/Api/External.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/External.pm b/lib/Pear/LocalLoop/Controller/Api/External.pm index f28f7fa..b34b1c0 100644 --- a/lib/Pear/LocalLoop/Controller/Api/External.pm +++ b/lib/Pear/LocalLoop/Controller/Api/External.pm @@ -255,7 +255,7 @@ sub post_supplier_history { my $third = $last->clone->subtract(months => 3); my $dtf = $c->schema->storage->datetime_parser; - my $year_rs = $c->schema->resultset('Transaction')->search( + my $year_rs = $c->schema->resultset('Entity')->search( { 'sales.purchase_time' => { -between => [ @@ -279,7 +279,7 @@ sub post_supplier_history { order_by => { '-asc' => 'organisation.name' }, } ); - my $half_year_rs = $c->schema->resultset('Transaction')->search( + my $half_year_rs = $c->schema->resultset('Entity')->search( { 'sales.purchase_time' => { -between => [ @@ -338,7 +338,7 @@ sub post_supplier_history { half_count => 0, half_total => 0, year_count => $row->get_column('count'), - year_total => $row->get_column('total_spend'), + year_total => $row->get_column('total_spend') / 100000, }; } @@ -349,7 +349,7 @@ sub post_supplier_history { quarter_count => 0, quarter_total => 0, half_count => $row->get_column('count'), - half_total => $row->get_column('total_spend'), + half_total => $row->get_column('total_spend') / 100000, year_count => 0, year_total => 0, %{$data{$row->get_column('id')}}, @@ -361,7 +361,7 @@ sub post_supplier_history { id => $row->get_column('id'), name => $row->get_column('name'), quarter_count => $row->get_column('count'), - quarter_total => $row->get_column('total_spend'), + quarter_total => $row->get_column('total_spend') / 100000, half_count => 0, half_total => 0, year_count => 0,