Skip to content

Commit

Permalink
Fix last update date on existing request
Browse files Browse the repository at this point in the history
  • Loading branch information
Sispheor committed Sep 27, 2023
1 parent 3f8ae1f commit 00798e8
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 9 deletions.
25 changes: 25 additions & 0 deletions service_catalog/migrations/0028_set_last_update_on_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 3.2.13 on 2023-09-27 08:53

from django.db import migrations


def update_requests(apps, schema_editor):
Request = apps.get_model('service_catalog', 'Request')
for request in Request.objects.all():
request.created = request.date_submitted
request.last_updated = request.date_submitted
from service_catalog.models import RequestState
if request.state == RequestState.COMPLETE:
request.last_updated = request.date_complete
request.save()


class Migration(migrations.Migration):

dependencies = [
('service_catalog', '0027_alter_approvalworkflow_scopes'),
]

operations = [
migrations.RunPython(update_requests),
]
20 changes: 11 additions & 9 deletions templates/service_catalog/request_details/approval.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,6 @@ <h3 class="timeline-header">Admin review</h3>
<div>
<i class="fas fa-play fa-lg bg-{{ object.get_state_display | map_color_next_state:'ACCEPTED' }}"></i>
<div class="timeline-item">
{% if object.date_complete %}
<span class="time"><i class="fas fa-clock"></i> {{ object.date_complete | squest_date_format }}</span>{% endif %}
<h3 class="timeline-header">Process the request</h3>
<div class="timeline-body">
{% if object.get_state_display == "ACCEPTED" %}
Expand Down Expand Up @@ -271,9 +269,10 @@ <h3 class="timeline-header">Process the request</h3>
<div>
<i class="fas fa-cog bg-success"></i>
<div class="timeline-item">
<h3 class="timeline-header text-success">Processing <a href="{{ object.tower_job_url }}"
class="float-right">Job: {{ object.tower_job_id }}</a>
</h3>
{% if object.date_complete %}
<span class="time"><i class="fas fa-clock"></i> {{ object.date_complete | squest_date_format }}</span>
{% endif %}
<h3 class="timeline-header text-success">Processing</h3>
<div class="timeline-body">
{% if object.get_state_display == "PROCESSING" %}
The request is currently being processed
Expand All @@ -290,9 +289,7 @@ <h3 class="timeline-header text-success">Processing <a href="{{ object.tower_job
<div>
<i class="fas fa-exclamation-triangle bg-danger"></i>
<div class="timeline-item">
<h3 class="timeline-header text-danger">Processing failed <a href="{{ object.tower_job_url }}"
class="float-right">Job: {{ object.tower_job_id }}</a>
</h3>
<h3 class="timeline-header text-danger">Processing failed</h3>
<div class="timeline-body">
The processing has failed and may require administrator attention.<br> Controller error:<br>
<div class="callout callout-danger">
Expand All @@ -302,12 +299,17 @@ <h3 class="timeline-header text-danger">Processing failed <a href="{{ object.tow
<div class="row justify-content-md-center">
<div class="timeline-footer">
{% with args_filter="process,"|addstr:object.id %}
{% if args_filter|can_proceed_request_action and can_process_request %}
{% if args_filter|can_proceed_request_action and can_process_request %}
<a class="btn btn-primary"
title="Process"
href="{% url 'service_catalog:request_process' object.id %}">
<i class="fas fa-play"></i> Retry process
</a>
<a class="btn btn-default"
title="Job"
href="{{ object.tower_job_url }}">
<i class="fas fa-bug"></i> Job #{{ object.tower_job_id }}
</a>
{% endif %}
{% endwith %}
</div>
Expand Down

0 comments on commit 00798e8

Please sign in to comment.