mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 05:28:49 -04:00
Add letter type when getting billing data for financial year
This commit is contained in:
@@ -214,7 +214,6 @@ def populate_monthly_billing(year):
|
||||
print('Email: {}'.format(email_res.monthly_totals))
|
||||
print('Letter: {}'.format(letter_res.monthly_totals))
|
||||
|
||||
|
||||
service_ids = get_service_ids_that_need_billing_populated(
|
||||
start_date=datetime(2016, 5, 1), end_date=datetime(2017, 8, 16)
|
||||
)
|
||||
@@ -223,13 +222,12 @@ def populate_monthly_billing(year):
|
||||
if year == 2016:
|
||||
start = 4
|
||||
|
||||
# for service_id in service_ids:
|
||||
# print('Starting to populate data for service {}'.format(str(service_id)))
|
||||
# print('Starting populating monthly billing for {}'.format(year))
|
||||
# for i in range(start, end):
|
||||
# print('Population for {}-{}'.format(i, year))
|
||||
# populate(service_id, year, i)
|
||||
populate('56fa9fd8-61de-4688-8bc7-2908a77367df', year, 10)
|
||||
for service_id in service_ids:
|
||||
print('Starting to populate data for service {}'.format(str(service_id)))
|
||||
print('Starting populating monthly billing for {}'.format(year))
|
||||
for i in range(start, end):
|
||||
print('Population for {}-{}'.format(i, year))
|
||||
populate(service_id, year, i)
|
||||
|
||||
|
||||
@notify_command()
|
||||
|
||||
@@ -8,9 +8,9 @@ from app.dao.notification_usage_dao import get_billing_data_for_month
|
||||
from app.models import (
|
||||
SMS_TYPE,
|
||||
EMAIL_TYPE,
|
||||
LETTER_TYPE,
|
||||
MonthlyBilling,
|
||||
NotificationHistory,
|
||||
LETTER_TYPE
|
||||
NotificationHistory
|
||||
)
|
||||
from app.statsd_decorators import statsd
|
||||
from app.utils import convert_utc_to_bst
|
||||
@@ -22,7 +22,7 @@ def get_service_ids_that_need_billing_populated(start_date, end_date):
|
||||
).filter(
|
||||
NotificationHistory.created_at >= start_date,
|
||||
NotificationHistory.created_at <= end_date,
|
||||
NotificationHistory.notification_type.in_([SMS_TYPE, EMAIL_TYPE]),
|
||||
NotificationHistory.notification_type.in_([SMS_TYPE, EMAIL_TYPE, LETTER_TYPE]),
|
||||
NotificationHistory.billable_units != 0
|
||||
).distinct().all()
|
||||
|
||||
@@ -30,8 +30,8 @@ def get_service_ids_that_need_billing_populated(start_date, end_date):
|
||||
@statsd(namespace="dao")
|
||||
def create_or_update_monthly_billing(service_id, billing_month):
|
||||
start_date, end_date = get_month_start_and_end_date_in_utc(billing_month)
|
||||
# _update_monthly_billing(service_id, start_date, end_date, SMS_TYPE)
|
||||
# _update_monthly_billing(service_id, start_date, end_date, EMAIL_TYPE)
|
||||
_update_monthly_billing(service_id, start_date, end_date, SMS_TYPE)
|
||||
_update_monthly_billing(service_id, start_date, end_date, EMAIL_TYPE)
|
||||
_update_monthly_billing(service_id, start_date, end_date, LETTER_TYPE)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user