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.
This commit is contained in:
parent
841c5e08de
commit
8ffdeddf4a
1 changed files with 2 additions and 2 deletions
|
@ -566,11 +566,11 @@ class MoodCountHeatmapJSONView(LoginRequiredMixin, View):
|
||||||
user=request.user, timestamp__gte=mindate, timestamp__lte=maxdate
|
user=request.user, timestamp__gte=mindate, timestamp__lte=maxdate
|
||||||
|
|
||||||
)
|
)
|
||||||
.values("timestamp__date")
|
|
||||||
.annotate(value=Count("id"))
|
.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))
|
res.write(json.dumps(data))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue