From affa101169ea242d7597078bc131403eb3624f5a Mon Sep 17 00:00:00 2001 From: Daniel Thompson Date: Thu, 25 Feb 2021 07:45:53 +0000 Subject: [PATCH] steplogger: Ensure today's data is updated when we provide it Currently steps from the last six minutes do not appear in the data. We can fix this by updating the data before creating the iterator. Signed-off-by: Daniel Thompson --- wasp/steplogger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wasp/steplogger.py b/wasp/steplogger.py index 77eb5fd..ca5a968 100644 --- a/wasp/steplogger.py +++ b/wasp/steplogger.py @@ -153,6 +153,11 @@ class StepLogger: now = time.localtime(self._t) if now[:3] == t[:3]: latest = self._data + + # Work out where we are in the dump period and update + # with the latest counts + i = self._t % DUMP_PERIOD // TICK_PERIOD + latest[i] = wasp.watch.accel.steps - self._steps else: latest = None