fix(calendar): wiederkehrende Termine nicht per Range filtern
Master-Event eines Serientermins liegt oft vor dem sichtbaren Bereich - das FullCalendar-RRULE-Plugin braucht ihn trotzdem zur Expansion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b398d6d800
commit
10a1dec448
|
|
@ -209,16 +209,25 @@ def list_events(cal_id):
|
||||||
end = request.args.get('end')
|
end = request.args.get('end')
|
||||||
|
|
||||||
query = CalendarEvent.query.filter_by(calendar_id=cal_id)
|
query = CalendarEvent.query.filter_by(calendar_id=cal_id)
|
||||||
|
# Wiederkehrende Termine duerfen nicht per Range gefiltert werden -
|
||||||
|
# die FullCalendar-RRULE-Plugin-Expansion im Frontend braucht den
|
||||||
|
# Master-Event auch wenn dessen dtstart vor dem sichtbaren Bereich liegt.
|
||||||
if start:
|
if start:
|
||||||
try:
|
try:
|
||||||
start_dt = datetime.fromisoformat(start)
|
start_dt = datetime.fromisoformat(start)
|
||||||
query = query.filter(CalendarEvent.dtend >= start_dt)
|
query = query.filter(db.or_(
|
||||||
|
CalendarEvent.recurrence_rule.isnot(None),
|
||||||
|
CalendarEvent.dtend >= start_dt,
|
||||||
|
))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
if end:
|
if end:
|
||||||
try:
|
try:
|
||||||
end_dt = datetime.fromisoformat(end)
|
end_dt = datetime.fromisoformat(end)
|
||||||
query = query.filter(CalendarEvent.dtstart <= end_dt)
|
query = query.filter(db.or_(
|
||||||
|
CalendarEvent.recurrence_rule.isnot(None),
|
||||||
|
CalendarEvent.dtstart <= end_dt,
|
||||||
|
))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue