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 6838ec2 database: Prevent division by zero.
6838ec2 is described below
commit 6838ec2eac8eae2c3743fca76ad0cda87b4df5fb
Author: Mathieu Othacehe <[email protected]>
AuthorDate: Sat Jan 30 16:14:04 2021 +0100
database: Prevent division by zero.
* src/cuirass/database.scm (db-get-build-percentage): Prevent division by
zero.
---
src/cuirass/database.scm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index d66db01..b0bc1eb 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -676,7 +676,7 @@ WHERE job_name = " job-name "AND specification = "
specification
SELECT LEAST(duration::float/last_duration * 100, 100)::int AS percentage FROM
(SELECT (extract(epoch from now())::int - starttime) as duration,
last_build.duration AS last_duration FROM builds,
-(SELECT (stoptime - starttime) AS duration FROM Builds
+(SELECT GREATEST((stoptime - starttime), 1) AS duration FROM Builds
WHERE job_name IN
(SELECT job_name from Builds WHERE id = " build-id ")
AND status = 0