Skip to content

Commit

Permalink
updating job status states
Browse files Browse the repository at this point in the history
  • Loading branch information
Beverly Nguyen authored and Beverly Nguyen committed Jan 15, 2025
1 parent 9293586 commit 8754c03
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/main/views/dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def service_dashboard(service_id):
"created_at": job["created_at"],
"processing_finished": job.get("processing_finished"),
"processing_started": job.get("processing_started"),
"scheduled_for": job.get("scheduled_for"),
"notification_count": job["notification_count"],
"created_by": job["created_by"],
"template_name": job["template_name"],
Expand All @@ -87,7 +88,7 @@ def service_dashboard(service_id):
"views/dashboard/dashboard.html",
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
partials=get_dashboard_partials(service_id),
jobs=jobs,
jobs=sorted(jobs, key=lambda job: job["created_at"], reverse=True)[:5],
service_data_retention_days=service_data_retention_days,
sms_sent=sms_sent,
sms_allowance_remaining=sms_allowance_remaining,
Expand Down
18 changes: 14 additions & 4 deletions app/templates/views/dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ <h2 class="margin-top-4 margin-bottom-1">Service activity</h2>
</thead>
<tbody>
{% if jobs %}
{% for job in jobs[:5] %}
{% for job in jobs %}
{% set notification = job.notifications[0] %}
<tr id="{{ job.job_id }}">
<td class="table-field jobid" role="rowheader">
Expand All @@ -122,9 +122,19 @@ <h2 class="margin-top-4 margin-bottom-1">Service activity</h2>
</a>
</td>
<td class="table-field template">{{ job.template_name }}</td>
<td class="table-field time-sent">Sent on
{{ (job.processing_finished if job.processing_finished else job.processing_started
if job.processing_started else job.created_at)|format_datetime_table }}
<td class="table-field time-sent">
{% if job.scheduled_for and not job.processing_finished %}
Scheduled for
{{ job.scheduled_for|format_datetime_table }}
{% else %}
{% if job.processing_finished %}
Sent on {{job.processing_finished|format_datetime_table}}
{% elif job.processing_started %}
Sending since {{job.processing_started|format_datetime_table}}
{% else %}
Created at {{job.created_at|format_datetime_table}}
{% endif %}
{% endif %}
</td>
<td class="table-field sender">{{ job.created_by.name }}</td>
<td class="table-field count-of-recipients">{{ job.notification_count }}</td>
Expand Down

0 comments on commit 8754c03

Please sign in to comment.