From 8c2f41c2d57d09f53b4101d99304ef870ae33710 Mon Sep 17 00:00:00 2001 From: James Woglom Date: Tue, 1 Oct 2024 16:30:18 -0400 Subject: [PATCH] skip processing no basal events --- tconnectsync/sync/tandemsource/process_basal.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tconnectsync/sync/tandemsource/process_basal.py b/tconnectsync/sync/tandemsource/process_basal.py index a2f2b10..de8427f 100644 --- a/tconnectsync/sync/tandemsource/process_basal.py +++ b/tconnectsync/sync/tandemsource/process_basal.py @@ -38,11 +38,15 @@ class ProcessBasal: for event in sorted(events, key=lambda x: x.eventTimestamp): if last_upload_time and arrow.get(event.eventTimestamp) <= last_upload_time: if self.pretend: - logger.info("Skipping basal event before last upload time: %s (time range: %s - %s)" % (event, time_start, time_end)) + logger.info("Skipping basal event not after last upload time: %s (time range: %s - %s)" % (event, time_start, time_end)) continue with_duration.append([event.eventTimestamp, None, event]) + if not with_duration: + logger.info("No basal events found to process") + return [] + for i in range(len(with_duration)-1): with_duration[i][1] = with_duration[i+1][0] - with_duration[i][0]