django-scheduler
django-scheduler copied to clipboard
Cancelled Occurrence replaced by a new Event/Occurrence causes occurrences_after to fail
Where there is an Event with a cancelled Occurrence, but another Event has been scheduled in place of the original at the same time, it causes EventListManager.occurrences_after()
to fail at next_occurrence = heapq.heappop(occurrences)[0]
with an '<' not supported between instances of 'generator' and 'generator'
error.
Part of the issue seems to be that EventListManager.occurrences_after()
doesn't employ the same logic as Event.get_occurrences()
to work persisted occurrences
into the generator
set.
For example, in a case where an Event
has only a single Occurrence
and that Occurrence is cancelled, how should that be treated here? In either case, it causes occurrences_after()
to fail which isn't the correct behaviour.
The use of OccurrenceReplacer
happens at the end, but it has already failed due to match Occurrences
being added to the heap.