diff options
-rw-r--r-- | src/cuirass/database.scm | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm index 9b17c67..adc046f 100644 --- a/src/cuirass/database.scm +++ b/src/cuirass/database.scm @@ -1312,18 +1312,16 @@ AND (:system IS NULL and STATUS." (with-db-worker-thread db (let ((rows (sqlite-exec db " -SELECT stoptime, MIN(rowid) FROM -(SELECT rowid, stoptime FROM Builds +SELECT stoptime, rowid FROM Builds WHERE evaluation=" eval " -AND stoptime = (SELECT MIN(stoptime) -FROM Builds -WHERE evaluation = " eval " AND (" status " IS NULL OR (" status " = 'pending' AND Builds.status < 0) OR (" status " = 'succeeded' AND Builds.status = 0) OR (" status " = 'failed' - AND Builds.status > 0))))"))) + AND Builds.status > 0)) +ORDER BY stoptime ASC, rowid ASC +LIMIT 1"))) (and=> (expect-one-row rows) vector->list)))) (define (db-get-builds-max eval status) @@ -1331,18 +1329,16 @@ AND (" status " IS NULL OR (" status " = 'pending' and STATUS." (with-db-worker-thread db (let ((rows (sqlite-exec db " -SELECT stoptime, MAX(rowid) FROM -(SELECT rowid, stoptime FROM Builds -WHERE evaluation=" eval " AND -stoptime = (SELECT MAX(stoptime) -FROM Builds -WHERE evaluation = " eval " +SELECT stoptime, rowid FROM Builds +WHERE evaluation=" eval " AND (" status " IS NULL OR (" status " = 'pending' AND Builds.status < 0) OR (" status " = 'succeeded' AND Builds.status = 0) OR (" status " = 'failed' - AND Builds.status > 0))))"))) + AND Builds.status > 0)) +ORDER BY stoptime DESC, rowid DESC +LIMIT 1"))) (and=> (expect-one-row rows) vector->list)))) (define (db-get-evaluation-specification eval) |