fixed counts for sqlite vs postgres

This commit is contained in:
Finn 2017-12-18 14:46:32 +00:00
parent f1c1748b34
commit cc0ca06470
3 changed files with 16 additions and 4 deletions

View File

@ -18,7 +18,10 @@ sub transaction_data {
columns => [
{
quantised => $quantised_column,
count => \"COUNT(*)",
count => $c->pg_or_sqlite(
'count',
"COUNT(*)",
),
sum_distance => $c->pg_or_sqlite(
'SUM("me"."distance")',
'SUM("me"."distance")',

View File

@ -86,7 +86,10 @@ sub post_customer {
columns => [
{
quantised => 'quantised_weeks',
count => \"COUNT(*)",
count => $c->pg_or_sqlite(
'count',
"COUNT(*)",
),
}
],
group_by => 'quantised_weeks',
@ -103,7 +106,10 @@ sub post_customer {
join => { 'seller' => 'organisation' },
columns => {
sector => "organisation.sector",
count => \"COUNT(*)",
count => $c->pg_or_sqlite(
'count',
"COUNT(*)",
),
},
group_by => "organisation.sector",
order_by => { '-desc' => "COUNT(*)" },

View File

@ -112,7 +112,10 @@ sub _purchases_avg_spend_duration {
columns => [
{
quantised => 'quantised_days',
count => \"COUNT(*)",
count => $c->pg_or_sqlite(
'count',
"COUNT(*)",
),
sum_value => $c->pg_or_sqlite(
'SUM("me"."value")',
'SUM("me"."value")',