aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model/build.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-10-21 19:47:11 +0100
committerChristopher Baines <mail@cbaines.net>2020-10-21 19:47:11 +0100
commitfa6e4ac8427b4f1b36437214434d18462cbfca1d (patch)
tree3fe897542f1b960e00b90d11fd361f7fc2dd0999 /guix-data-service/model/build.scm
parent6a04d474c06b9bcfb91ee07d3639755024d1ff1c (diff)
downloaddata-service-fa6e4ac8427b4f1b36437214434d18462cbfca1d.tar
data-service-fa6e4ac8427b4f1b36437214434d18462cbfca1d.tar.gz
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).
Diffstat (limited to 'guix-data-service/model/build.scm')
-rw-r--r--guix-data-service/model/build.scm12
1 files changed, 10 insertions, 2 deletions
diff --git a/guix-data-service/model/build.scm b/guix-data-service/model/build.scm
index 8ec0af2..972a16a 100644
--- a/guix-data-service/model/build.scm
+++ b/guix-data-service/model/build.scm
@@ -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