mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 06:21:50 -05:00
filter out test jobs from the GET /service/{}/job endpoint
this is so that the filtering, which we do on the admin side, is applied before pagination - so that the pages returned are all valid displayable jobs. unfortunately this means that another config value has to be copied to the server side but it's not the end of the world
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
from datetime import datetime
|
||||
|
||||
from flask import current_app
|
||||
from sqlalchemy import func, desc, asc, cast, Date as sql_date
|
||||
|
||||
from app import db
|
||||
@@ -28,7 +29,10 @@ def dao_get_job_by_service_id_and_job_id(service_id, job_id):
|
||||
|
||||
|
||||
def dao_get_jobs_by_service_id(service_id, limit_days=None, page=1, page_size=50, statuses=None):
|
||||
query_filter = [Job.service_id == service_id]
|
||||
query_filter = [
|
||||
Job.service_id == service_id,
|
||||
Job.original_file_name != current_app.config['TEST_MESSAGE_FILENAME']
|
||||
]
|
||||
if limit_days is not None:
|
||||
query_filter.append(cast(Job.created_at, sql_date) >= days_ago(limit_days))
|
||||
if statuses is not None and statuses != ['']:
|
||||
|
||||
Reference in New Issue
Block a user