summaryrefslogtreecommitdiff
path: root/src/home/database/inverter.py
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-10-25 02:49:44 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-10-25 02:49:44 +0300
commitdbc33cf2293238534fd4d268e6a6d9405daae758 (patch)
treeb258067841870d8100424cf36f527f31e44b3db0 /src/home/database/inverter.py
parented8f8839affd30d7fa3c8f51afaf714be6109551 (diff)
db/inverter: fix retrieving intervals
Diffstat (limited to 'src/home/database/inverter.py')
-rw-r--r--src/home/database/inverter.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/home/database/inverter.py b/src/home/database/inverter.py
index 8ebfae2..756186c 100644
--- a/src/home/database/inverter.py
+++ b/src/home/database/inverter.py
@@ -158,7 +158,7 @@ class InverterDatabase:
ranges = [[None, None]]
while rows is None or len(rows) > 0:
- if ranges[len(ranges) - 1][0] is None:
+ if ranges[len(ranges)-1][0] is None:
condition = cond_start
range_idx = 0
else:
@@ -182,6 +182,8 @@ class InverterDatabase:
if ranges[len(ranges)-1][0] is None:
ranges.pop()
+ elif ranges[len(ranges)-1][1] is None:
+ ranges[len(ranges)-1][1] = dt_to - timedelta(seconds=1)
return ranges