From 309183b156b86411f4dcc788625c256b0fb3883b Mon Sep 17 00:00:00 2001 From: danielghost Date: Thu, 3 Jul 2025 17:00:22 +0100 Subject: [PATCH] Fix: invalid `getScaledScoreFromMinMax` value when there is no range (fixes #23). --- js/utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/utils.js b/js/utils.js index ab94363..4670b50 100644 --- a/js/utils.js +++ b/js/utils.js @@ -187,6 +187,7 @@ export function getSubSetByPath(path, subsetParent = undefined) { export function getScaledScoreFromMinMax(score, minScore, maxScore) { // range split into negative/positive ranges (rather than min-max normalization) depending on score const range = (score < 0) ? Math.abs(minScore) : maxScore; + if (!range) return 0; return Math.round((score / range) * 100); }