From 2699e7b9ec0d88188b7acaf7d5c44ee10dc6e9b4 Mon Sep 17 00:00:00 2001 From: juberti Date: Mon, 22 Apr 2024 15:03:52 -0700 Subject: [PATCH] Fix TPS --- website/src/components/DataGrid.astro | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/website/src/components/DataGrid.astro b/website/src/components/DataGrid.astro index 17e6822..e46365e 100644 --- a/website/src/components/DataGrid.astro +++ b/website/src/components/DataGrid.astro @@ -105,10 +105,14 @@ Astro.response.headers.set('Cache-Control', 'no-cache'); }; const def = map[currentColumnID]; if (def) { - if (params.value <= def.bestPerformance) { - return {backgroundColor: style.getPropertyValue('--good-color')}; - } else if (params.value >= def.worstPerformance) { - return {backgroundColor: style.getPropertyValue('--bad-color')}; + const isGood = def.worstPerformance > def.bestPerformance ? + params.value < def.bestPerformance : params.value > def.bestPerformance; + const isBad = def.worstPerformance > def.bestPerformance ? + params.value > def.worstPerformance : params.value < def.worstPerformance; + if (isGood) { + return { backgroundColor: style.getPropertyValue('--good-color') }; + } else if (isBad) { + return { backgroundColor: style.getPropertyValue('--bad-color') }; } } return {};