Skip to content

Commit

Permalink
fix(examples): fixed bug where it doesn't update rows between midnigh…
Browse files Browse the repository at this point in the history
…t and day_offset
  • Loading branch information
ErikBjare committed Jan 18, 2024
1 parent c2b051e commit 7e12bf2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/working_hours_gspread.py
Expand Up @@ -17,6 +17,7 @@
Usage:
python3 working_hours_gspread.py <sheet_key> <regex>
"""

import socket
import sys
from datetime import datetime, time, timedelta
Expand Down Expand Up @@ -92,6 +93,10 @@ def update_sheet(sheet_key: str, regex: str):

# Iterate over the result and update or append the data to the Google Sheet
for tp, r in zip(timeperiods, res):
# skip if the timeperiod is in the future (might happen between midnight and the day_offset)
if tp[0] > now:
continue

date = tp[0].date()
duration = (
working_hours.generous_approx(r["events"], break_time).total_seconds()
Expand Down

0 comments on commit 7e12bf2

Please sign in to comment.