mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-06 00:48:46 -04:00
changed time column
This commit is contained in:
@@ -54,6 +54,7 @@ from app.formatters import (
|
||||
format_datetime_normal,
|
||||
format_datetime_relative,
|
||||
format_datetime_short,
|
||||
format_datetime_short_america,
|
||||
format_day_of_week,
|
||||
format_delta,
|
||||
format_delta_days,
|
||||
@@ -548,6 +549,7 @@ def add_template_filters(application):
|
||||
format_datetime_24h,
|
||||
format_datetime_normal,
|
||||
format_datetime_short,
|
||||
format_datetime_short_america,
|
||||
valid_phone_number,
|
||||
linkable_name,
|
||||
format_date,
|
||||
|
||||
@@ -97,6 +97,20 @@ def format_datetime_short(date):
|
||||
format_date_short(date), format_time_24h(date), get_user_preferred_timezone()
|
||||
)
|
||||
|
||||
def format_datetime_short_america(date):
|
||||
return "{} at {} {}".format(
|
||||
format_date_normal_america(date), format_time_12h(date),get_user_preferred_timezone()
|
||||
)
|
||||
|
||||
def format_date_normal_america(date):
|
||||
date = parse_naive_dt(date)
|
||||
return date.strftime("%B %d, %Y").lstrip("0")
|
||||
|
||||
def format_time_12h(date):
|
||||
date = parse_naive_dt(date)
|
||||
|
||||
preferred_tz = pytz.timezone(get_user_preferred_timezone())
|
||||
return date.replace(tzinfo=timezone.utc).astimezone(preferred_tz).strftime("%I:%M %p")
|
||||
|
||||
def format_datetime_relative(date):
|
||||
return "{} at {} {}".format(
|
||||
|
||||
@@ -54,22 +54,21 @@ def service_dashboard(service_id):
|
||||
job_response = job_api_client.get_jobs(service_id)
|
||||
|
||||
service_data_retention_days = 7
|
||||
jobs = []
|
||||
for job in job_response['data']:
|
||||
job_info = {
|
||||
"job_id": job["id"],
|
||||
"time_left": get_time_left(job["created_at"]),
|
||||
"download_link": url_for(".view_job_csv", service_id=current_service.id, job_id=job["id"]),
|
||||
"notification_count": job["notification_count"],
|
||||
jobs = [
|
||||
{
|
||||
"job_id": job["id"],
|
||||
"time_left": get_time_left(job["created_at"]),
|
||||
"download_link": url_for(".view_job_csv", service_id=current_service.id, job_id=job["id"]),
|
||||
"notification_count": job["notification_count"],
|
||||
}
|
||||
jobs.append(job_info)
|
||||
for job in job_response.get('data', [])
|
||||
]
|
||||
return render_template(
|
||||
"views/dashboard/dashboard.html",
|
||||
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
|
||||
partials=get_dashboard_partials(service_id),
|
||||
notifications=notifications,
|
||||
jobs=jobs,
|
||||
job_response = job_response,
|
||||
service_data_retention_days=service_data_retention_days,
|
||||
)
|
||||
|
||||
|
||||
@@ -48,10 +48,10 @@
|
||||
{{ item.template.name }}
|
||||
{% endcall %}
|
||||
{% call row_heading() %}
|
||||
{{ item.status|format_notification_status_as_time(
|
||||
item.created_at|format_datetime_short,
|
||||
(item.updated_at or item.created_at)|format_datetime_short)
|
||||
}}
|
||||
{{ item.status|format_notification_status_as_time(
|
||||
item.created_at|format_datetime_short_america,
|
||||
(item.updated_at or item.created_at)|format_datetime_short_america
|
||||
) }}
|
||||
{% endcall %}
|
||||
{% call row_heading() %}
|
||||
{{ item.created_by.name }}
|
||||
|
||||
Reference in New Issue
Block a user