Use the status for ordering, as well as timestamp

As this will handle cases where the timestamps from Cuirass don't make sense,
like a build being canceled with a timestamp of 0 (1970).
This commit is contained in:
Christopher Baines 2020-10-21 19:47:11 +01:00
parent 6a04d474c0
commit fa6e4ac842

View file

@ -253,7 +253,11 @@ SELECT build_servers.url,
'timestamp', build_status.timestamp,
'status', build_status.status
)
ORDER BY build_status.timestamp
ORDER BY CASE WHEN status = 'scheduled' THEN -2
WHEN status = 'started' THEN -1
ELSE 0
END ASC,
timestamp ASC
)
FROM build_status
WHERE build_status.build_id = builds.id
@ -295,7 +299,11 @@ SELECT build_servers.url,
'timestamp', build_status.timestamp,
'status', build_status.status
)
ORDER BY build_status.timestamp
ORDER BY CASE WHEN status = 'scheduled' THEN -2
WHEN status = 'started' THEN -1
ELSE 0
END ASC,
timestamp ASC
)
FROM build_status
WHERE build_status.build_id = builds.id