-
Notifications
You must be signed in to change notification settings - Fork 132
Support concurrency of multiple RDATE together with RRULE directives. #716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Support concurrency of multiple RDATE together with RRULE directives. #716
Conversation
Signed-off-by: Claus-Justus Heine <[email protected]>
|
Actually, the changes to the |
Nope, it ain't that easy. However, this is also due to the current code base. If the current event DTSTART refers to a date after the dates defined by an RDATE rule, then the ordering of the values returned by the current This also means that further changes would be needed. The RDate iterator has to take care of this. |
RDATE is an execption. We do not have control over the point in time where the exception is scheduled and hence should not assume that is is always after DTSTART.
…TART is the earliest date. It should also not assume that the list of dates is sorted at all.
Signed-off-by: Claus-Justus Heine <[email protected]>
| foreach ($this->masterEvent->RDATE as $rDate) { | ||
| $this->recurIterators[] = new RDateIterator( | ||
| $rDate->getParts(), | ||
| $this->startDate, | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of creating an array of iterators would it be easier to combine all the rdate instances in to a single iterator?
$rdateValues = [];
foreach ($this->masterEvent->RDATE as $rdate) {
$rdateValues = array_merge($rdateValues, $rdate->getParts());
}
$this->recurIterator = new RDateIterator(
$this->masterEvent->RDATE->getParts(),
$rdateValues,
$this->startDate
);
This would reduce the complexity of iterating through RRULE and RDATE significantly, you would only need to rewind, forward, and check 2 iterators, instead of looping through an array of iterators.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not look into this for a long time now. I am no longer using upstream Sabre, but rather my own forks with my bug fixes, due to lack of responsiveness of the maintainers of Sabre. No flame intended, but we all have only a limited amount of time available, this applies as well to the maintainers of a software package as to potential contributors (which might be at the same time over-loaded maintainers of other software packages). I'll post a more useful response as soon as I find the time to look into your suggestions.
This PR address #347 and its duplicate #700. The commit also adds a test. The idea is to maintain an array of iterators, compare their current values and pick the smallest one in next(). Then all iterators matching the timestamp value of the chosen DateTime are advanced, which the others which may be invalid or have their individual current values still ahead of time are kept at their position.
I have added a test (with one RRULE and RDATES which are placed "out of order").