From 4b989d322c598ed0a807e0e2179a071bc823894f Mon Sep 17 00:00:00 2001 From: Arseniy Movshev Date: Tue, 30 May 2023 11:35:13 +0100 Subject: Make steps graph trigger a recording when the app starts This should mean we always have the most up-to-date data. I am not sure this will work - the daemon may still be taking the reading as the graph draws, so the data still isn't fresh. Frankly, the daemon's recording mechanism needs a rewrite, and this is a stopgap. --- src/main.qml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.qml b/src/main.qml index af4dd13..bcf12d8 100644 --- a/src/main.qml +++ b/src/main.qml @@ -27,11 +27,6 @@ Application { centerColor: "#b04d1c" outerColor: "#421c0a" - StepsDataLoader { - id: stepsDataLoader - // Component.onCompleted: stepsLabel.text = getTodayData() - } - property var weekday: ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]; @@ -75,7 +70,14 @@ Application { property var maxValue: 0 property var divisionsInterval: 0 property var divisionsCount: 0 - Component.onCompleted: { + StepsDataLoader { + id: stepsDataLoader + Component.onCompleted: { + triggerDaemonRecording() + stepsGraph.loadData() + } + } + function loadData() { var currDate = new Date() currDate.setDate(currDate.getDate() - 7) for (var i = 0; i < 7; i++) { -- cgit v1.2.3-54-g00ecf