From fb11e79c2e3bfa6ebe2b4e4a09889d0aff7f35fe Mon Sep 17 00:00:00 2001 From: Clément Lassieur Date: Sat, 4 Aug 2018 14:46:37 +0200 Subject: database: Fix the evaluations limit issue. * src/cuirass/database.scm (db-get-evaluations-build-summary): Use a 'LEFT JOIN' instead of a 'JOIN', with 'Evaluations' on the left, so that evaluations are displayed even when they don't have associated builds. --- src/cuirass/database.scm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm index 1f86a1d..4927f2a 100644 --- a/src/cuirass/database.scm +++ b/src/cuirass/database.scm @@ -639,11 +639,7 @@ FROM Evaluations ORDER BY id DESC LIMIT " limit ";")) (define (db-get-evaluations-build-summary db spec limit border-low border-high) (let loop ((rows (sqlite-exec db " SELECT E.id, E.commits, B.succeeded, B.failed, B.scheduled -FROM (SELECT id, evaluation, SUM(status=0) as succeeded, -SUM(status>0) as failed, SUM(status<0) as scheduled -FROM Builds -GROUP BY evaluation) B -JOIN +FROM (SELECT id, commits FROM Evaluations WHERE (specification=" spec ") @@ -651,6 +647,11 @@ AND (" border-low "IS NULL OR (id >" border-low ")) AND (" border-high "IS NULL OR (id <" border-high ")) ORDER BY CASE WHEN " border-low "IS NULL THEN id ELSE -id END DESC LIMIT " limit ") E +LEFT JOIN +(SELECT id, evaluation, SUM(status=0) as succeeded, +SUM(status>0) as failed, SUM(status<0) as scheduled +FROM Builds +GROUP BY evaluation) B ON B.evaluation=E.id ORDER BY E.id ASC;")) (evaluations '())) @@ -660,9 +661,9 @@ ORDER BY E.id ASC;")) (loop rest (cons `((#:id . ,id) (#:commits . ,commits) - (#:succeeded . ,succeeded) - (#:failed . ,failed) - (#:scheduled . ,scheduled)) + (#:succeeded . ,(or succeeded 0)) + (#:failed . ,(or failed 0)) + (#:scheduled . ,(or scheduled 0))) evaluations)))))) (define (db-get-evaluations-id-min db spec) -- cgit v1.2.3