From 2ec4606c389a37e04fddf602fc2ab3c7f52027ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Vonheiden?= <bjoern.vonheiden@hotmail.de> Date: Wed, 25 Aug 2021 17:41:47 +0200 Subject: [PATCH] use decimal notation for percentage value of lag trend --- .../kotlin/theodolite/evaluation/SloCheckerFactory.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt b/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt index 68e5abc6b..3a00b8ab5 100644 --- a/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt +++ b/theodolite/src/main/kotlin/theodolite/evaluation/SloCheckerFactory.kt @@ -37,11 +37,13 @@ class SloCheckerFactory { throw IllegalArgumentException("Percent Threshold is only allowed with load type NumSensors") } var thresholdPercent = - properties["percent"]?.toInt() ?: throw IllegalArgumentException("percent for threshold expected") - if (thresholdPercent < 0 || thresholdPercent > 100) { - throw IllegalArgumentException("Threshold percent need to be an Int in the range between 0 and 100 (inclusive)") + properties["percent"]?.toDouble() + ?: throw IllegalArgumentException("percent for threshold expected") + if (thresholdPercent < 0.0 || thresholdPercent > 1.0) { + throw IllegalArgumentException("Threshold percent need to be an Double in the range between 0.0 and 1.0 (inclusive)") } - var threshold = (load.get() / 100.0 * thresholdPercent).toInt() + // cast to int, as rounding is not really necessary + var threshold = (load.get() * thresholdPercent).toInt() ExternalSloChecker( externalSlopeURL = properties["externalSloUrl"] -- GitLab