database: Prevent division by zero.

* src/cuirass/database.scm (db-get-build-percentage): Prevent division by zero.
This commit is contained in:
Mathieu Othacehe 2021-01-30 16:14:04 +01:00
parent 158dd2bd42
commit 6838ec2eac
No known key found for this signature in database
GPG Key ID: 8354763531769CA6
1 changed files with 1 additions and 1 deletions

View File

@ -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