aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorClément Lassieur <clement@lassieur.org>2018-08-04 14:46:37 +0200
committerClément Lassieur <clement@lassieur.org>2018-08-04 16:34:27 +0200
commitfb11e79c2e3bfa6ebe2b4e4a09889d0aff7f35fe (patch)
tree5cf894491aecea66351d7ff402b7fb913a68ecdf /src
parentdc27cb369c7bc358717e586262fdb2a7d509ff29 (diff)
downloadcuirass-fb11e79c2e3bfa6ebe2b4e4a09889d0aff7f35fe.tar
cuirass-fb11e79c2e3bfa6ebe2b4e4a09889d0aff7f35fe.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/database.scm17
1 files changed, 9 insertions, 8 deletions
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)