From 7e12bf2c9727b6abba01e36669c04ebc69b5c89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Thu, 18 Jan 2024 01:47:33 +0100 Subject: [PATCH] fix(examples): fixed bug where it doesn't update rows between midnight and day_offset --- examples/working_hours_gspread.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/working_hours_gspread.py b/examples/working_hours_gspread.py index 689913d..3270c84 100644 --- a/examples/working_hours_gspread.py +++ b/examples/working_hours_gspread.py @@ -17,6 +17,7 @@ Usage: python3 working_hours_gspread.py """ + import socket import sys from datetime import datetime, time, timedelta @@ -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()