Closed cgansen closed 11 years ago
Quick data sanity checks:
cwfy=# SELECT COUNT(*) FROM service_requests WHERE DATE(closed_datetime) = '2013-08-20' AND ward = 32 AND service_code = '4fd3b167e750846744000005' AND duplicate IS NULL;
count
-------
12
(1 row)
cwfy=# select * from daily_closed_counts WHERE requested_date = '2013-08-20' AND ward = 32 AND service_code = '4fd3b167e750846744000005';
requested_date | service_code | total | ward
----------------+--------------------------+-------+------
2013-08-20 | 4fd3b167e750846744000005 | 12 | 32
(1 row)
cwfy=# select * from daily_closed_counts WHERE requested_date = '2013-08-20' AND ward = 1 AND service_code = '4fd3b167e750846744000005';
requested_date | service_code | total | ward
----------------+--------------------------+-------+------
2013-08-20 | 4fd3b167e750846744000005 | 7 | 1
(1 row)
cwfy=# SELECT COUNT(*) FROM service_requests WHERE DATE(closed_datetime) = '2013-08-20' AND ward = 1 AND service_code = '4fd3b167e750846744000005' AND duplicate IS NULL;
count
-------
7
(1 row)
cwfy=# select sum(total) from daily_closed_counts WHERE requested_date = '2013-08-20' AND service_code = '4fd3b167e750846744000005';
sum
-----
500
(1 row)
cwfy=# SELECT COUNT(*) FROM service_requests WHERE DATE(closed_datetime) = '2013-08-20' AND service_code = '4fd3b167e750846744000005' AND duplicate IS NULL;
count
-------
500
(1 row)
@santheo this is now on staging. Data will be sparse until we reload everything.
Closes #205
This updates the
ward/[id]/counts.json
endpoint to return the number of SR opened and closed in a given ward over a range of days.