From 8ffdeddf4a9f51527b213adac9cd04c5bc2c0f1d Mon Sep 17 00:00:00 2001 From: Kumi Date: Sun, 17 Nov 2024 20:05:40 +0100 Subject: [PATCH] fix: Refines data transformation in heatmap view Simplifies data processing by removing unnecessary value extraction. Prepares for future enhancement to return color as value with count as tooltip. --- mood/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mood/views.py b/mood/views.py index c70f2b5..84a0887 100644 --- a/mood/views.py +++ b/mood/views.py @@ -566,11 +566,11 @@ class MoodCountHeatmapJSONView(LoginRequiredMixin, View): user=request.user, timestamp__gte=mindate, timestamp__lte=maxdate ) - .values("timestamp__date") .annotate(value=Count("id")) ) - data = [{"date": d["timestamp__date"].strftime("%Y-%m-%d"), "value": d["value"]} for d in data] + # TODO: Should eventually change this so that it returns a *color* as a value and the count as a tooltip + data = [{"date": d.timestamp.strftime("%Y-%m-%d"), "value": d.value} for d in data] res.write(json.dumps(data))