guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: database: Fix db-get-build-percentages.


From: Mathieu Othacehe
Subject: branch master updated: database: Fix db-get-build-percentages.
Date: Wed, 14 Apr 2021 12:36:22 -0400

This is an automated email from the git hooks/post-receive script.

mothacehe pushed a commit to branch master
in repository guix-cuirass.

The following commit(s) were added to refs/heads/master by this push:
     new ff64d4a  database: Fix db-get-build-percentages.
ff64d4a is described below

commit ff64d4ae29b16603b6800c4b6204a86686157b72
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Wed Apr 14 18:35:46 2021 +0200

    database: Fix db-get-build-percentages.
    
    * src/cuirass/database.scm (db-get-build-percentages): Return 0 if no 
previous
    build was found.
---
 src/cuirass/database.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index 7194562..c3450a5 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -668,13 +668,14 @@ WHERE specification = " specification
   (with-db-worker-thread db
     (let loop ((rows
                 (exec-query/bind db "
-SELECT LEAST(duration::float/last_duration * 100, 100)::int AS percentage
+SELECT COALESCE((SELECT
+LEAST(duration::float/last_duration * 100, 100)::int AS percentage
 FROM (SELECT  DISTINCT ON (b1.id) b1.id AS id,
 GREATEST((b2.stoptime - b2.starttime), 1) AS last_duration,
 (extract(epoch from now())::int - b1.starttime) AS duration FROM builds AS b1
 LEFT JOIN builds AS b2 ON b1.job_name = b2.job_name WHERE b1.id IN
 (SELECT id FROM builds WHERE id = ANY(" build-ids "))
-AND b2.status >= 0 ORDER BY b1.id,  b2.id DESC) d;"))
+AND b2.status >= 0 ORDER BY b1.id,  b2.id DESC) d), 0);"))
                (percentages '()))
       (match rows
         (() (reverse percentages))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]