fix TypeError: can't compare offset-naive and offset-aware datetimes

This commit is contained in:
James Woglom
2025-11-23 00:03:16 -05:00
parent 73dabe5ead
commit 2bf40cac28
+4 -1
View File
@@ -1,5 +1,6 @@
import logging import logging
import collections import collections
import arrow
from ...features import DEVICE_STATUS, DEFAULT_FEATURES from ...features import DEVICE_STATUS, DEFAULT_FEATURES
from ...eventparser import events as eventtypes from ...eventparser import events as eventtypes
@@ -82,7 +83,9 @@ class ProcessTimeRange:
if c.enabled(): if c.enabled():
logger.info("%s is enabled from features %s" % (clazz, self.features)) logger.info("%s is enabled from features %s" % (clazz, self.features))
# Cap events_last_time at time_end to handle pump clock drift # Cap events_last_time at time_end to handle pump clock drift
capped_time_end = min(events_last_time, time_end) if events_last_time else time_end # Ensure time_end is timezone-aware for comparison
time_end_aware = arrow.get(time_end)
capped_time_end = min(events_last_time, time_end_aware) if events_last_time else time_end_aware
ns_entries = c.process(events, events_first_time, capped_time_end) ns_entries = c.process(events, events_first_time, capped_time_end)
w = c.write(ns_entries) w = c.write(ns_entries)
if w: if w: