mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-11 09:28:27 -04:00
Use list comprehensions instead of filter
“filter's pretty oldschool” – @leohemsted
This commit is contained in:
@@ -112,18 +112,16 @@ def get_dashboard_partials(service_id):
|
||||
template_statistics_client.get_template_statistics_for_service(service_id, limit_days=7)
|
||||
)
|
||||
|
||||
jobs = add_rate_to_jobs(filter(
|
||||
lambda job: job['original_file_name'] != current_app.config['TEST_MESSAGE_FILENAME'],
|
||||
job_api_client.get_job(service_id, limit_days=7)['data']
|
||||
))
|
||||
scheduled_jobs = filter(
|
||||
lambda job: job['job_status'] == 'scheduled',
|
||||
jobs
|
||||
)
|
||||
immediate_jobs = filter(
|
||||
lambda job: job['job_status'] != 'scheduled',
|
||||
jobs
|
||||
)
|
||||
jobs = add_rate_to_jobs([
|
||||
job for job in job_api_client.get_job(service_id, limit_days=7)['data']
|
||||
if job['original_file_name'] != current_app.config['TEST_MESSAGE_FILENAME']
|
||||
])
|
||||
scheduled_jobs = [
|
||||
job for job in jobs if job['job_status'] == 'scheduled'
|
||||
]
|
||||
immediate_jobs = [
|
||||
job for job in jobs if job['job_status'] != 'scheduled'
|
||||
]
|
||||
service = service_api_client.get_detailed_service(service_id)
|
||||
|
||||
return {
|
||||
|
||||
@@ -65,10 +65,10 @@ def _set_status_filters(filter_args):
|
||||
def view_jobs(service_id):
|
||||
return render_template(
|
||||
'views/jobs/jobs.html',
|
||||
jobs=filter(
|
||||
lambda job: job['job_status'] != 'scheduled',
|
||||
add_rate_to_jobs(job_api_client.get_job(service_id)['data'])
|
||||
)
|
||||
jobs=add_rate_to_jobs([
|
||||
job for job in job_api_client.get_job(service_id)['data']
|
||||
if job['job_status'] != 'scheduled'
|
||||
])
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user