Commit Graph

13 Commits

Author SHA1 Message Date
Imdad Ahad
af54d98faa Remove unused imports 2017-08-30 14:40:54 +01:00
Imdad Ahad
94605d31fa Change how we populate and retrieve MonthlyBilling totals:
1. For both email and sms, store [] in monthly_totals if
there is no billing data (no notifications sent etc.) and
return this via the API

2. General refactoring of indentation
2017-08-15 16:09:42 +01:00
Imdad Ahad
69845e9f37 Add helper methods to retrieve billing data from the new table:
Get yearly and monthly billing data from the new table
with filter by notification type. Additionally let's calculate
current day delta totals
2017-08-11 16:57:18 +01:00
Imdad Ahad
839c161628 Update monthly billing for SMS and Email:
* Refactor code to update for EMAIL_TYPE and SMS_TYPE
* Make tests more robust (overlapping rates, multiple months, multiple noti
* types)
*
2017-08-11 16:57:18 +01:00
Imdad Ahad
d01d875f7e Fix issue where monthly billing data was not being updated: 2017-07-31 17:47:53 +01:00
Rebecca Law
c1f2634c90 Removed month and year and replaced it with start_date and end_date.
This will allow us to sort the data properly.
2017-07-26 13:19:17 +01:00
Rebecca Law
9c55fa7f34 Use the end date for the month, when we are in BST the first day of the month is an hour behind and in the previous month. 2017-07-25 18:08:46 +01:00
Rebecca Law
5612ca023e - Add transactional
- Rename function for clarity
2017-07-25 14:26:42 +01:00
Rebecca Law
d2a1da9ea6 Removed comment 2017-07-25 11:44:39 +01:00
Rebecca Law
eaf5cbb868 Add labels to query so that the named tuples can be referenced later.
Remove unnecessary function
2017-07-25 11:43:41 +01:00
Rebecca Law
3e2b8190b9 - Added a scheduled task to create or update billing for the month, yesterday is used to calculate the start and end date for the month.
- The new task has not been added to the beat application yet.
- Added an updated_at column to the monthly billing table, we may want to only calculate from the last updated date rather than the entire month.
2017-07-24 15:13:18 +01:00
Rebecca Law
9400988d72 Monthly billing - part 1
This is still a work in progress but it would be good to get some eyes on it.
This commit includes creating and updating a row in the monthly billing table and a method to fetch the results.
There is a command to populate the monthly billing for a service and month so we can try it out.
The total cost at the moment are wrong, they do not take into account the free allowance - see notes below about adding that to the table.
Left to do:
create a nightly task to run to update the monthly totals.
create an endpoint to return the yearly billing, the current day will need to be calculated on the fly and added to the totals.
Add the free allowance into the total costs.
2017-07-18 18:21:35 +01:00
Rebecca Law
4b05c32b62 Create a new table to warehouse the monthly billing numbers 2017-07-13 17:22:11 +01:00