Skip to content

Commit 7e12bf2

Browse files
committed
fix(examples): fixed bug where it doesn't update rows between midnight and day_offset
1 parent c2b051e commit 7e12bf2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

examples/working_hours_gspread.py

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
Usage:
1818
python3 working_hours_gspread.py <sheet_key> <regex>
1919
"""
20+
2021
import socket
2122
import sys
2223
from datetime import datetime, time, timedelta
@@ -92,6 +93,10 @@ def update_sheet(sheet_key: str, regex: str):
9293

9394
# Iterate over the result and update or append the data to the Google Sheet
9495
for tp, r in zip(timeperiods, res):
96+
# skip if the timeperiod is in the future (might happen between midnight and the day_offset)
97+
if tp[0] > now:
98+
continue
99+
95100
date = tp[0].date()
96101
duration = (
97102
working_hours.generous_approx(r["events"], break_time).total_seconds()

0 commit comments

Comments
 (0)