summaryrefslogtreecommitdiff
path: root/calendar_manager.py
diff options
context:
space:
mode:
authormatin <matin.kaufmann@gmail.com>2025-09-12 17:24:18 +0200
committermatin <matin.kaufmann@gmail.com>2025-09-12 17:24:18 +0200
commita1094ac2e0762073dc527d11e8555ae12b208294 (patch)
tree5a0cab6a6bbd6c34a1f806e8d9482ed941411b8d /calendar_manager.py
parent39654f7140ebfeafc2473ceb7e4739ed6d03fc1c (diff)
(hopefully) fixed bug with overlapping time periods
Diffstat (limited to 'calendar_manager.py')
-rw-r--r--calendar_manager.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/calendar_manager.py b/calendar_manager.py
index 9ef6596..f6ec0db 100644
--- a/calendar_manager.py
+++ b/calendar_manager.py
@@ -4,7 +4,7 @@ import uuid
from datetime import datetime
class CalendarEntry:
- def __init__(self, start_date, end_date, keyword, entry_id=None, corrected_start_date=None, corrected_end_date=None, commentary: str = ""):
+ def __init__(self, start_date, end_date, keyword, entry_id=None, corrected_start_date=None, corrected_end_date=None, time_period=None, commentary: str = ""):
self.id = entry_id if entry_id else str(uuid.uuid4())
# Convert string dates to datetime if necessary
self.start_date = (
@@ -20,6 +20,7 @@ class CalendarEntry:
self.keyword = keyword
self.corrected_start_date = corrected_start_date
self.corrected_end_date = corrected_end_date
+ self.time_period = time_period
self.commentary = commentary
def to_dict(self):
return {
@@ -135,9 +136,13 @@ class CalendarManager:
for entry in self.entries:
entry.corrected_start_date = None
entry.corrected_end_date = None
+ entry.time_period = None
for start_date, end_date, original_id in list_of_events:
entry = self.get_entry_by_id(original_id)
+ if not entry:
+ continue
+
entry.corrected_start_date = start_date
entry.corrected_end_date = end_date