mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 05:28:49 -04:00
Added changes to support extra day in activity chart (#1928)
This commit is contained in:
@@ -66,7 +66,8 @@ def dao_get_jobs_by_service_id(
|
||||
if limit_days is not None:
|
||||
if use_processing_time:
|
||||
query_filter.append(
|
||||
func.coalesce(Job.processing_started, Job.created_at) >= midnight_n_days_ago(limit_days)
|
||||
func.coalesce(Job.processing_started, Job.created_at)
|
||||
>= midnight_n_days_ago(limit_days)
|
||||
)
|
||||
else:
|
||||
query_filter.append(Job.created_at >= midnight_n_days_ago(limit_days))
|
||||
|
||||
@@ -230,7 +230,7 @@ def get_service_notification_statistics(service_id):
|
||||
data=get_service_statistics(
|
||||
service_id,
|
||||
request.args.get("today_only") == "True",
|
||||
int(request.args.get("limit_days", 7)),
|
||||
int(request.args.get("limit_days", 8)),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -794,7 +794,7 @@ def get_detailed_service(service_id, today_only=False):
|
||||
return detailed_service_schema.dump(service)
|
||||
|
||||
|
||||
def get_service_statistics(service_id, today_only, limit_days=7):
|
||||
def get_service_statistics(service_id, today_only, limit_days=8):
|
||||
check_suspicious_id(service_id)
|
||||
# today_only flag is used by the send page to work out if the service will exceed their daily usage by sending a job
|
||||
if today_only:
|
||||
|
||||
@@ -20,7 +20,7 @@ register_errors(template_statistics)
|
||||
@template_statistics.route("")
|
||||
def get_template_statistics_for_service_by_day(service_id):
|
||||
check_suspicious_id(service_id)
|
||||
whole_days = request.args.get("whole_days", request.args.get("limit_days", ""))
|
||||
whole_days = request.args.get("whole_days", request.args.get("limit_days", "8"))
|
||||
try:
|
||||
whole_days = int(whole_days)
|
||||
except ValueError:
|
||||
@@ -28,9 +28,9 @@ def get_template_statistics_for_service_by_day(service_id):
|
||||
message = {"whole_days": [error]}
|
||||
raise InvalidRequest(message, status_code=400)
|
||||
|
||||
if whole_days < 0 or whole_days > 7:
|
||||
if whole_days < 0 or whole_days > 8:
|
||||
raise InvalidRequest(
|
||||
{"whole_days": ["whole_days must be between 0 and 7"]}, status_code=400
|
||||
{"whole_days": ["whole_days must be between 0 and 8"]}, status_code=400
|
||||
)
|
||||
data = fetch_notification_status_for_service_for_today_and_7_previous_days(
|
||||
service_id, by_template=True, limit_days=whole_days
|
||||
|
||||
Reference in New Issue
Block a user