From 617df8fdd11167203ffaeddf6461400c8dd25a33 Mon Sep 17 00:00:00 2001 From: Matheus Lima Date: Tue, 4 Jun 2019 16:48:47 -0300 Subject: [PATCH] Fixing query --- shared/selene/data/account/repository/sql/daily_report.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/selene/data/account/repository/sql/daily_report.sql b/shared/selene/data/account/repository/sql/daily_report.sql index 1928ced6..926a7c86 100644 --- a/shared/selene/data/account/repository/sql/daily_report.sql +++ b/shared/selene/data/account/repository/sql/daily_report.sql @@ -1,7 +1,7 @@ SELECT COUNT(acc) AS total, COUNT(acc) FILTER(WHERE acc.insert_ts::DATE >= (CURRENT_DATE - INTERVAL %(start)s)) AS total_new, - COUNT(acc) FILTER(WHERE acc_mem.account_id IS NULL) as free_total, + COUNT(acc) FILTER(WHERE acc_mem.account_id IS NULL OR UPPER(acc_mem.membership_ts_range) IS NOT NULL) as free_total, COUNT(mem) FILTER(WHERE mem.rate_period = 'month' AND UPPER(acc_mem.membership_ts_range) IS NULL) AS monthly_total, COUNT(mem) FILTER(WHERE mem.rate_period = 'month' AND UPPER(acc_mem.membership_ts_range) IS NULL AND LOWER(acc_mem.membership_ts_range) >= (CURRENT_DATE - INTERVAL %(start)s)) AS monthly_new, COUNT(mem) FILTER(WHERE mem.rate_period = 'month' AND UPPER(acc_mem.membership_ts_range) IS NOT NULL AND UPPER(acc_mem.membership_ts_range) >= (CURRENT_DATE - INTERVAL %(start)s)) AS monthly_minus,