From 32da68e9057e5f0f2c7c8a0a72662c038c39166e Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Thu, 26 Oct 2023 21:11:56 +1300 Subject: [PATCH] Handle entering multiple weights in a single day The graph would otherwise use I believe the first entry? Now we use the average. --- ViewWeightGraph.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ViewWeightGraph.tsx b/ViewWeightGraph.tsx index 73c99bb..f21a25c 100644 --- a/ViewWeightGraph.tsx +++ b/ViewWeightGraph.tsx @@ -28,8 +28,8 @@ export default function ViewWeightGraph() { weightRepo .createQueryBuilder() .select("STRFTIME('%Y-%m-%d', created)", "created") + .addSelect("AVG(value) as value") .addSelect("unit") - .addSelect("value") .where("DATE(created) >= DATE('now', 'weekday 0', :difference)", { difference, })