mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
Return postage from the monthly-usage endpoint
We were already returning the month, notification_type, billing_units and rate from the /monthly-usage billing endpoint. This adds in the postage too so that we can display postage details on the usage page of admin.
This commit is contained in:
@@ -87,7 +87,8 @@ def fetch_monthly_billing_for_year(service_id, year):
|
||||
func.sum(FactBilling.notifications_sent).label("notifications_sent"),
|
||||
func.sum(FactBilling.notifications_sent).label("billable_units"),
|
||||
FactBilling.rate.label('rate'),
|
||||
FactBilling.notification_type.label('notification_type')
|
||||
FactBilling.notification_type.label('notification_type'),
|
||||
FactBilling.postage
|
||||
).filter(
|
||||
FactBilling.service_id == service_id,
|
||||
FactBilling.bst_date >= year_start_date,
|
||||
@@ -96,7 +97,8 @@ def fetch_monthly_billing_for_year(service_id, year):
|
||||
).group_by(
|
||||
'month',
|
||||
FactBilling.rate,
|
||||
FactBilling.notification_type
|
||||
FactBilling.notification_type,
|
||||
FactBilling.postage
|
||||
)
|
||||
|
||||
sms = db.session.query(
|
||||
@@ -104,7 +106,8 @@ def fetch_monthly_billing_for_year(service_id, year):
|
||||
func.sum(FactBilling.notifications_sent).label("notifications_sent"),
|
||||
func.sum(FactBilling.billable_units * FactBilling.rate_multiplier).label("billable_units"),
|
||||
FactBilling.rate,
|
||||
FactBilling.notification_type
|
||||
FactBilling.notification_type,
|
||||
FactBilling.postage
|
||||
).filter(
|
||||
FactBilling.service_id == service_id,
|
||||
FactBilling.bst_date >= year_start_date,
|
||||
@@ -113,7 +116,8 @@ def fetch_monthly_billing_for_year(service_id, year):
|
||||
).group_by(
|
||||
'month',
|
||||
FactBilling.rate,
|
||||
FactBilling.notification_type
|
||||
FactBilling.notification_type,
|
||||
FactBilling.postage
|
||||
)
|
||||
|
||||
yearly_data = email_and_letters.union_all(sms).order_by(
|
||||
|
||||
Reference in New Issue
Block a user