Commit Graph

70 Commits

Author SHA1 Message Date
Rebecca Law
e5584348ef Add rate to the primary key of ft_billing.
Use the primary key constraint in the upsert statement (easier to read than listing all the columns)
2018-05-21 14:38:25 +01:00
Rebecca Law
c2b888a6af Make sure the date does not include time 2018-05-21 11:51:06 +01:00
Rebecca Law
4d8255b8d9 Merge branch 'master' into fix-ft-billing-migration 2018-05-21 11:06:31 +01:00
Rebecca Law
9fad623d91 Update the ft_billing query to only include billable notification status types.
Update test_provider_statistics dao - this is really irrelevant since the endpoint using the query is not being used. We have a PR coming to delete the unused code.
Update rate_multiplier to always be an integer
2018-05-21 10:56:16 +01:00
Rebecca Law
3c90c0ffcd Fix code style 2018-05-16 13:18:36 +01:00
Rebecca Law
eb083e30ed - Only rebuild current month for monthly_billing if today is in the current year.
- Change the usage queries to a union so that billing_units is correct for all notification types. Removing the business logic from the schema.
- Added tests for different fragment counts, rates and sheet counts.
2018-05-16 12:21:59 +01:00
Rebecca Law
271ce6d76e Changed the update/insert to a postgres upsert to avoid concurrency issues. 2018-05-15 11:21:10 +01:00
Rebecca Law
3615f3d00f In order to re-run the create_nightly_billing for dates in the past, we added a condition on which table is used.
This will allow us to re-run nightly billing for those 2 days where it failed.
For the majority of time the query will run on Notiifcations.
2018-05-14 16:21:16 +01:00
Rebecca Law
d98581cfe6 Added a new endpoint for yearly usage totals using ft_billing. 2018-05-11 16:25:16 +01:00
Rebecca Law
8028f6cc28 We found that the reporting task failed twice because of integrity constraints.
This was because the rate_multiplier was being added as 1 and 1.0 which was not resolving to the same.
This updates the table to use Integrer.
Also changed the logging for the task.
2018-05-10 15:35:58 +01:00
Rebecca Law
3e3b885bdc Realised that it's best to cast the Month as date. 2018-05-08 13:53:44 +01:00
Rebecca Law
ea3523199a New endpoint to get monthly billing usage from the ft_billing table.
New command to compare the results of monthly billing to ft_billing.
2018-05-04 13:09:14 +01:00
Rebecca Law
18c2b9a56d Use better date function to get the first of each month.
Build the json object to return for the new endpoint.
2018-05-02 09:36:13 +01:00
Rebecca Law
0fb9c1d318 Add notification_type to query 2018-05-02 09:36:13 +01:00
Rebecca Law
51af6b27a0 Update name of method to clarify the meaning.
Update group by to use label.
Update test.
2018-04-25 17:00:19 +01:00
Rebecca Law
cff731c52d Set filter on query 2018-04-25 16:17:56 +01:00
Rebecca Law
d00614205e Adding test for fetch_biling_data_for_day. 2018-04-25 14:45:51 +01:00
Rebecca Law
16ef133aa5 Refactor reporting task so that methods can be used for the annual usage page.
Still a work in progress, tests are coming.
2018-04-25 14:45:51 +01:00
Rebecca Law
bd91aac763 Write some pseudo code for ft billing 2018-04-25 14:45:51 +01:00
Rebecca Law
8cd4e1be29 Query ft_billing aggregate for a month 2018-04-25 14:45:51 +01:00