mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-26 01:03:41 -04:00
revert test to 1.4
This commit is contained in:
@@ -646,8 +646,8 @@ def populate_annual_billing_with_defaults(year, missing_services_only):
|
|||||||
This is useful to ensure all services start the new year with the correct annual billing.
|
This is useful to ensure all services start the new year with the correct annual billing.
|
||||||
"""
|
"""
|
||||||
if missing_services_only:
|
if missing_services_only:
|
||||||
stmt = (
|
active_services = (
|
||||||
select(Service)
|
Service.query.filter(Service.active)
|
||||||
.outerjoin(
|
.outerjoin(
|
||||||
AnnualBilling,
|
AnnualBilling,
|
||||||
and_(
|
and_(
|
||||||
@@ -655,19 +655,20 @@ def populate_annual_billing_with_defaults(year, missing_services_only):
|
|||||||
AnnualBilling.financial_year_start == year,
|
AnnualBilling.financial_year_start == year,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.where(Service.active)
|
.filter(AnnualBilling.id == None) # noqa
|
||||||
.where(AnnualBilling.id == None) # noqa
|
.all()
|
||||||
)
|
)
|
||||||
active_services = db.session.execute(stmt).scalars().all()
|
|
||||||
else:
|
else:
|
||||||
stmt = select(Service).where(Service.active)
|
active_services = Service.query.filter(Service.active).all()
|
||||||
active_services = db.session.execute(stmt).scalars().all()
|
|
||||||
previous_year = year - 1
|
previous_year = year - 1
|
||||||
stmt = select(AnnualBilling.id).where(
|
services_with_zero_free_allowance = (
|
||||||
AnnualBilling.financial_year_start == previous_year,
|
db.session.query(AnnualBilling.service_id)
|
||||||
AnnualBilling.free_sms_fragment_limit == 0,
|
.filter(
|
||||||
|
AnnualBilling.financial_year_start == previous_year,
|
||||||
|
AnnualBilling.free_sms_fragment_limit == 0,
|
||||||
|
)
|
||||||
|
.all()
|
||||||
)
|
)
|
||||||
services_with_zero_free_allowance = db.session.execute(stmt).scalars().all()
|
|
||||||
|
|
||||||
for service in active_services:
|
for service in active_services:
|
||||||
# If a service has free_sms_fragment_limit for the previous year
|
# If a service has free_sms_fragment_limit for the previous year
|
||||||
|
|||||||
Reference in New Issue
Block a user