fix: Fixes heatmap key conversion issue

Ensures keys returned from moodOptions are correctly
converted to numbers to prevent mismatch errors and
improve accuracy in data processing.
This commit is contained in:
Kumi 2024-11-28 15:36:44 +01:00
parent c0fb79ed5c
commit 2decdba78c
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -25,7 +25,7 @@ fetch("/mood/statistics/heatmap/values/")
if (d.average) {
const key = Object.keys(moodOptions).reduce((a, b) => Math.abs(a - d.average) < Math.abs(b - d.average) ? a : b);
console.log(key, d.average, moodOptions[key]);
return key;
return Number(key);
}
return 0;
},