mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 22:42:28 -05:00
Align date range for template + notification stats
We were using two different queries to filter template stats to the past 7 days, plus today. Since we’re storing both as short dates, we can now use the same query for both. 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 -------|---------|-----------|----------|--------|----------|--------|------- Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | Monday So if we are on Monday, the stats should include today, plus everything back to last Monday. Previously the template stats query was only going back to the Tuesday. This should mean the numbers on the dashboard always line up.
This commit is contained in:
@@ -4,10 +4,7 @@ from flask import (
|
||||
request
|
||||
)
|
||||
|
||||
from app.dao.notifications_dao import (
|
||||
dao_get_notification_statistics_for_service,
|
||||
dao_get_notification_statistics_for_service_and_previous_days
|
||||
)
|
||||
from app.dao.notifications_dao import dao_get_notification_statistics_for_service
|
||||
from app.schemas import notifications_statistics_schema
|
||||
|
||||
notifications_statistics = Blueprint(
|
||||
@@ -25,7 +22,7 @@ def get_all_notification_statistics_for_service(service_id):
|
||||
|
||||
if request.args.get('limit_days'):
|
||||
try:
|
||||
statistics = dao_get_notification_statistics_for_service_and_previous_days(
|
||||
statistics = dao_get_notification_statistics_for_service(
|
||||
service_id=service_id,
|
||||
limit_days=int(request.args['limit_days'])
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user