mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-16 20:49:00 -04:00
Delete unused functions and their tests
This commit is contained in:
@@ -523,20 +523,6 @@ def requested_and_current_financial_year(request):
|
||||
abort(404)
|
||||
|
||||
|
||||
def format_template_stats_to_list(stats_dict):
|
||||
if not stats_dict:
|
||||
return []
|
||||
for template_id, template in stats_dict.items():
|
||||
yield dict(
|
||||
requested_count=sum(
|
||||
template['counts'].get(status, 0)
|
||||
for status in REQUESTED_STATUSES
|
||||
),
|
||||
id=template_id,
|
||||
**template
|
||||
)
|
||||
|
||||
|
||||
def get_tuples_of_financial_years(
|
||||
partial_url,
|
||||
start=2015,
|
||||
|
||||
@@ -60,14 +60,6 @@ from app.utils import (
|
||||
)
|
||||
|
||||
|
||||
def get_page_headings(template_type):
|
||||
return {
|
||||
'email': 'Email templates',
|
||||
'sms': 'Text message templates',
|
||||
'letter': 'Letter templates'
|
||||
}[template_type]
|
||||
|
||||
|
||||
def get_example_csv_fields(column_headers, use_example_as_example, submitted_fields):
|
||||
if use_example_as_example:
|
||||
return ["example" for header in column_headers]
|
||||
@@ -776,25 +768,6 @@ def get_recipient_and_placeholders_from_session(template_type):
|
||||
return placeholders
|
||||
|
||||
|
||||
def make_and_upload_csv_file(service_id, template):
|
||||
upload_id = s3upload(
|
||||
service_id,
|
||||
Spreadsheet.from_dict(
|
||||
session['placeholders'],
|
||||
filename=current_app.config['TEST_MESSAGE_FILENAME']
|
||||
).as_dict,
|
||||
current_app.config['AWS_REGION'],
|
||||
)
|
||||
return redirect(url_for(
|
||||
'.check_messages',
|
||||
upload_id=upload_id,
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
from_test=True,
|
||||
help=2 if get_help_argument() else 0
|
||||
))
|
||||
|
||||
|
||||
def all_placeholders_in_session(placeholders):
|
||||
return all(
|
||||
get_normalised_placeholders_from_session().get(placeholder, False) not in (False, None)
|
||||
|
||||
@@ -850,21 +850,6 @@ def get_template_sender_form_dict(service_id, template):
|
||||
return context
|
||||
|
||||
|
||||
def get_last_use_message(template_name, template_statistics):
|
||||
try:
|
||||
most_recent_use = max(
|
||||
parse(template_stats['updated_at']).replace(tzinfo=None)
|
||||
for template_stats in template_statistics
|
||||
)
|
||||
except ValueError:
|
||||
return '{} has never been used'.format(template_name)
|
||||
|
||||
return '{} was last used {} ago'.format(
|
||||
template_name,
|
||||
get_human_readable_delta(most_recent_use, datetime.utcnow())
|
||||
)
|
||||
|
||||
|
||||
def get_human_readable_delta(from_time, until_time):
|
||||
delta = until_time - from_time
|
||||
if delta < timedelta(seconds=60):
|
||||
@@ -878,10 +863,3 @@ def get_human_readable_delta(from_time, until_time):
|
||||
else:
|
||||
days = delta.days
|
||||
return '{} day{}'.format(days, '' if days == 1 else 's')
|
||||
|
||||
|
||||
def should_show_template(template_type):
|
||||
return (
|
||||
template_type != 'letter' or
|
||||
current_service.has_permission('letter')
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user