17501 fix showing last run of script job execution in list view

This commit is contained in:
Arthur Hanson 2024-09-23 11:53:00 -07:00
parent 6b219a279b
commit b305458b25
2 changed files with 2 additions and 7 deletions

View File

@ -410,12 +410,7 @@ class JobsMixin(models.Model):
"""
Return a dictionary mapping of the most recent jobs for this instance.
"""
return {
job.name: job
for job in self.jobs.filter(
status__in=JobStatusChoices.TERMINAL_STATE_CHOICES
).order_by('name', '-created').distinct('name').defer('data')
}
return self.jobs.filter(status__in=JobStatusChoices.TERMINAL_STATE_CHOICES).order_by('-created').defer('data')
class JournalingMixin(models.Model):

View File

@ -50,7 +50,7 @@
</thead>
<tbody>
{% for script in module.scripts.all %}
{% with last_job=script.get_latest_jobs|get_key:script.name %}
{% with last_job=script.get_latest_jobs|first %}
<tr>
<td>
{% if script.is_executable %}