From a26c27c8e62afd832eda7688061d16f64844a23d Mon Sep 17 00:00:00 2001 From: Dominik Csapak Date: Fri, 17 Jul 2020 15:39:16 +0200 Subject: [PATCH] api2/status: fix estimation bug when a datastore has enough data to calculate the estimated full date, but always has exactly the same usage, the factor b of the regression is '0' return 0 for that case so that the gui can show 'never' instead of 'not enough data' Signed-off-by: Dominik Csapak --- src/api2/status.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api2/status.rs b/src/api2/status.rs index 34e05056..4f985430 100644 --- a/src/api2/status.rs +++ b/src/api2/status.rs @@ -161,6 +161,8 @@ fn datastore_status( if b != 0.0 { let estimate = (1.0 - a) / b; entry["estimated-full-date"] = Value::from(estimate.floor() as u64); + } else { + entry["estimated-full-date"] = Value::from(0); } } }