mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
Merge pull request #1940 from alphagov/dashboard-day-limit
Sort out the dashboard day limits
This commit is contained in:
@@ -37,7 +37,7 @@ from app.models import (
|
||||
SMS_TYPE,
|
||||
LETTER_TYPE,
|
||||
)
|
||||
from app.utils import get_london_month_from_utc_column, get_london_midnight_in_utc
|
||||
from app.utils import get_london_month_from_utc_column, get_london_midnight_in_utc, midnight_n_days_ago
|
||||
|
||||
DEFAULT_SERVICE_PERMISSIONS = [
|
||||
SMS_TYPE,
|
||||
@@ -247,8 +247,8 @@ def delete_service_and_all_associated_db_objects(service):
|
||||
|
||||
@statsd(namespace="dao")
|
||||
def dao_fetch_stats_for_service(service_id):
|
||||
# We want 7 days inclusive
|
||||
start_date = get_london_midnight_in_utc(date.today() - timedelta(days=6))
|
||||
# We always want between seven and eight days
|
||||
start_date = midnight_n_days_ago(7)
|
||||
return _stats_for_service_query(service_id).filter(
|
||||
Notification.created_at >= start_date
|
||||
).all()
|
||||
|
||||
Reference in New Issue
Block a user