Commit 6a2638fb authored by Neil Williams's avatar Neil Williams
Browse files

Handle cancelled test jobs in get_recent_jobs



Ensure get_recent_jobs_for_device_type can return data
if job.actual_device has not been assigned, e.g. whilst
in Submitted.
Move the hostname check inside the loop
Signed-off-by: default avatarNeil Williams <neil.williams@linaro.org>
parent c56ab4c6
......@@ -442,11 +442,14 @@ class SchedulerAPI(ExposedAPI):
job_qs = job_qs.filter(submitter=self.user)
job_list = []
for job in job_qs.all()[:count]:
hostname = ''
if job.actual_device:
hostname = job.actual_device.hostname
job_dict = {
"id": job.id,
"description": job.description,
"status": job.get_legacy_status_display(),
"device": job.actual_device.hostname,
"device": hostname,
}
if not job.can_view(self.user):
job_dict["id"] = None
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment