[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Mathieu Othacehe |
Date: |
Wed, 11 Aug 2021 04:05:56 -0400 (EDT) |
branch: master
commit 1dcaebc66097ce503bd827c7b28e0a0936c1daee
Author: Mathieu Othacehe <othacehe@gnu.org>
AuthorDate: Wed Aug 11 10:05:27 2021 +0200
metrics: Prevent a zero division for eval-completion-speed.
* src/cuirass/metrics.scm (db-evaluation-completion-speed): Prevent a zero
division.
---
src/cuirass/metrics.scm | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/cuirass/metrics.scm b/src/cuirass/metrics.scm
index 6eae748..86cc2d4 100644
--- a/src/cuirass/metrics.scm
+++ b/src/cuirass/metrics.scm
@@ -170,10 +170,11 @@ expressed in builds per hour."
(exec-query/bind db "\
SELECT
3600.0 * SUM(CASE WHEN B.status = 0 THEN 1 ELSE 0 END) /
+GREATEST(
(CASE SUM(CASE WHEN status < 0 THEN 1 ELSE 0 END)
WHEN 0 THEN MAX(stoptime)
ELSE extract(epoch from 'today'::date)
-END - E.evaltime) FROM
+END - E.evaltime), 1) FROM
(SELECT id, evaltime
FROM Evaluations WHERE id = " eval ") E
LEFT JOIN Builds as B