From 745b44eb10a37db6204cf24d88a20e80d02c0919 Mon Sep 17 00:00:00 2001 From: MaxJa4 <74194322+MaxJa4@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:27:21 +0100 Subject: [PATCH] Fix diff coloring. --- templates/modals/full_calc.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/templates/modals/full_calc.html b/templates/modals/full_calc.html index ae4df1b..ef1952e 100644 --- a/templates/modals/full_calc.html +++ b/templates/modals/full_calc.html @@ -169,10 +169,13 @@ oppAvgScore.innerText = oppAvg.toFixed(2); if (!isNaN(homeAvg) && !isNaN(oppAvg)) { const diff = (((homeAvg / oppAvg) - 1.0) * 100).toFixed(1); - if (diff > 0) - diffScore.classList.replace('text-warning', 'text-success'); - else if (diff < 0) - diffScore.classList.replace('text-warning', 'text-danger'); + diffScore.classList.remove('text-warning'); + diffScore.classList.remove('text-success'); + diffScore.classList.remove('text-danger'); + if (diff > 0.0) + diffScore.classList.add('text-success'); + else if (diff < 0.0) + diffScore.classList.add('text-danger'); diffScore.innerText = diff + "%"; }