mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-24 00:07:02 -04:00
Filter test messages from jobs on the dashboard
While test messages technically have a file and are a job, there’s not much reason to ever revisit them. So all they end up doing is cluttering the dashboard and making it harder to find the actual files you’ve actually uploaded from your computer. So this commit: - abstracts the name of test messages into config - filters out any files whose filename represents a test message - adds some more thorough tests for the jobs on the dashboard
This commit is contained in:
@@ -7,7 +7,8 @@ from flask import (
|
||||
redirect,
|
||||
url_for,
|
||||
session,
|
||||
jsonify
|
||||
jsonify,
|
||||
current_app
|
||||
)
|
||||
|
||||
from flask_login import login_required
|
||||
@@ -169,5 +170,8 @@ def get_dashboard_statistics_for_service(service_id):
|
||||
'sms_allowance_remaining': max(0, (sms_free_allowance - sms_sent)),
|
||||
'sms_chargeable': max(0, sms_sent - sms_free_allowance),
|
||||
'sms_rate': sms_rate,
|
||||
'jobs': add_rate_to_jobs(job_api_client.get_job(service_id, limit_days=7)['data'])
|
||||
'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']
|
||||
))
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ def get_example_csv(service_id, template_id):
|
||||
@user_has_permissions('send_texts', 'send_emails', 'send_letters')
|
||||
def send_test(service_id, template_id):
|
||||
|
||||
file_name = 'Test message'
|
||||
file_name = current_app.config['TEST_MESSAGE_FILENAME']
|
||||
|
||||
template = Template(
|
||||
service_api_client.get_service_template(service_id, template_id)['data'],
|
||||
|
||||
Reference in New Issue
Block a user