mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Return financial year not calendar and ensure double precision values
are not returned from queries - Updated stats_template_usage_by_month_dao.py to return the results for financial year not calendar, as the report os for FY only and hence only the FY data is required - Updated services_dao.py to ensure double precision values are converted to an int as the 'exact' function returns double precision from the database query, as the admin code requires the value for month to be an int
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from sqlalchemy import or_, and_
|
||||
|
||||
from app import db
|
||||
from app.statsd_decorators import statsd
|
||||
from app.dao.dao_utils import transactional
|
||||
@@ -41,6 +43,15 @@ def dao_get_template_usage_stats_by_service(service_id, year):
|
||||
).join(
|
||||
Template, StatsTemplateUsageByMonth.template_id == Template.id
|
||||
).filter(
|
||||
Template.service_id == service_id,
|
||||
StatsTemplateUsageByMonth.year == year
|
||||
Template.service_id == service_id
|
||||
).filter(
|
||||
or_(
|
||||
and_(
|
||||
StatsTemplateUsageByMonth.month.in_([4, 5, 6, 7, 8, 9, 10, 11, 12]),
|
||||
StatsTemplateUsageByMonth.year == year
|
||||
), and_(
|
||||
StatsTemplateUsageByMonth.month.in_([1, 2, 3]),
|
||||
StatsTemplateUsageByMonth.year == year + 1
|
||||
)
|
||||
)
|
||||
).all()
|
||||
|
||||
Reference in New Issue
Block a user