feat: improve scheduler recurrence, DB config, and docs
- Broaden scheduler query window to next N days for proper recurring event expansion (scheduler.py) - Update DB connection logic for consistent .env loading and fallback (database.py) - Harden timezone handling and logging in scheduler and DB utils - Stop auto-deactivating recurring events before recurrence_end (API/events) - Update documentation to reflect new scheduler, API, and logging behavior
This commit is contained in:
@@ -48,10 +48,22 @@ def get_events():
|
||||
else:
|
||||
end_dt = e.end
|
||||
|
||||
# Setze is_active auf False, wenn Termin vorbei ist
|
||||
if end_dt and end_dt < now and e.is_active:
|
||||
e.is_active = False
|
||||
session.commit()
|
||||
# Auto-deactivate only non-recurring events past their end.
|
||||
# Recurring events remain active until their RecurrenceEnd (UNTIL) has passed.
|
||||
if e.is_active:
|
||||
if e.recurrence_rule:
|
||||
# For recurring, deactivate only when recurrence_end exists and is in the past
|
||||
rec_end = e.recurrence_end
|
||||
if rec_end and rec_end.tzinfo is None:
|
||||
rec_end = rec_end.replace(tzinfo=timezone.utc)
|
||||
if rec_end and rec_end < now:
|
||||
e.is_active = False
|
||||
session.commit()
|
||||
else:
|
||||
# Non-recurring: deactivate when end is in the past
|
||||
if end_dt and end_dt < now:
|
||||
e.is_active = False
|
||||
session.commit()
|
||||
if not (show_inactive or e.is_active):
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user