Closed Bug 386502 Opened 19 years ago Closed 19 years ago

dtstart is always included in recurrence set, even when it's out of the query range

Categories

(Calendar :: Internal Components, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mvl, Assigned: sebo.moz)

References

Details

Attachments

(4 files, 2 obsolete files)

When using calIRecurrenceInfo.getOccurrences(), the dtstart of the event is always included in the set, no matter if it is inside or outside the daterange that was passed in. This is a due to the fix in bug 381415 Not sure what the real-world implication of this is. At least the storage provider returns incorrect items, but i think the views filters them out. But anyway, it's not correct.
Blocks: 381415
Attached patch naive patchSplinter Review
This patch is mainly for my own reference. I think that it's incomplete, because it ignores event that start before the range of the query, and end inside the query (for example). Compare to the checks in the foreach below.
(In reply to comment #0) > Not sure what the real-world implication of this is. Bug 386559 and Bug 386563 seem to be occurrences of the issue described in this bug. Adding dependency so that the bugs can be retested once this issue resolved.
Blocks: 386559, 386563
I won't get around to this any time soon. Feel free to take it.
Assignee: mvl → nobody
Status: ASSIGNED → NEW
Hello, I have seen Bug 386563 in my installation here, and it got fixed by the patch which is added in comment #1. So maybe someone else can test ist also?
Flags: blocking-calendar0.7+
Please leave granting blocking flags to the release drivers.
Flags: blocking-calendar0.7+ → blocking-calendar0.7?
(In reply to comment #1) > This patch is mainly for my own reference. I think that it's incomplete, > because it ignores event that start before the range of the query, and end > inside the query (for example). Compare to the checks in the foreach below. > Wouldn't comparing to the modified start range (aka searchStart) solve this problem?
Thats what I had in mind. It seams to fix the bug how I saw it (displaying all recurring birthday entries in agenda and considering all alarm entries thereof).
Attachment #271851 - Flags: review?
Attachment #271851 - Flags: review? → review?(mvl)
Assignee: nobody → sebo.moz
Status: NEW → ASSIGNED
Comment on attachment 271851 [details] [diff] [review] use shifted start range The code inside the foreach block (a few lines later) has three checks: the start is in the range, the end is in the range, or the event starts before the range and ends after it. The code in the patch only has the first check. I think that's not quite right, and that we need all three checks. There might be an event that starts before the range, but extends into the range. That event should be included too I think (we do the same for all the recurrences, so why not for the 'original' item?) (I actually think that all three checks can be condensed into one: the event starts before the end of the range, and ends after the start of the range. I think we do that in other places too. But I'd like somebody to check my logic before applying it)
(In reply to comment #8) > (From update of attachment 271851 [details] [diff] [review]) > The code inside the foreach block (a few lines later) has three checks: the > start is in the range, That was included in your patch and still is in mine > the end is in the range, By shifting the start of the range by the amount of duration before the original start, we catch those events. > or the event starts before the range and ends after it. same applies here. This all depends on us knowing the duration of the event. If this is always the case, I don't know.
Good catch; IMO mvl is right, we need to check like we check exceptional items. This patch factors out the range check. Sebo, could you please verify the patch?
Attachment #272622 - Flags: review?(mvl)
Flags: blocking-calendar0.7? → blocking-calendar0.7+
Yes, it seems to fix the bug and also bug 386559. I still think it is more checking than actually needed. Since I have started to deal with this bug, I would appreciate if someone could shed some light on me, why my approach should not catch all mentioned cases. Also mvl's idea to only check if "start" is before "endRange" and "end" after "startRange" sounds reasonable and more elegant than the current implementation to me.
Assignee: sebo.moz → daniel.boelzle
Status: ASSIGNED → NEW
(In reply to comment #11) I think mvl's optimization is correct, too, except for the special case of todos without DUE: those need a check whether their DTSTART falls into the range. Sebo's patch looks correct to me, too, although I'd favor a general checkRange() function being used for both the baseItem and the exception set. I think that makes reading the code easier. Sebo: Do you volunteer to further optimize checkRange()?
Assignee: daniel.boelzle → nobody
Attachment #272622 - Flags: review?(mvl)
Attached patch modification of Daniels patch (obsolete) — Splinter Review
Ok, this is the modification of Daniels patch, that uses searchStart. There is one thing, that might make this approach problematic: If exceptions can have different durations than the parent item, then this is not taken into account. Daniel, is this a possible use-case? In this case the searchStart definition must be put into checkRange() and then the whole patch is probably not an optimization any more. Let me state that I don't care what patch is going in. My main concern was to know if the other approaches are also possible in theory, since I didn't see why they shouldn't. If you wish, I can also prepare a patch that applies mvl's approach. Let me know.
If there are any exceptions, those can have different durations, yes. But that's not a problem for this bug, because it is only about the 'base' item, which is not an exception. So I think that the searchStart approach works in the form of the first patch, which only applied to the base item, but does not work in the last form, because there it also touches recurrences and exceptions.
Attached patch second modification (obsolete) — Splinter Review
This is a modification of Daniels patch that uses mvl's approach (see comment 8).
Attachment #273304 - Attachment is obsolete: true
Comment on attachment 273334 [details] [diff] [review] second modification >+ var dtstart = item.getProperty("DTSTART"); >+ //tasks may have a due date set or no duration at all >+ var end = item.getProperty("DTEND") || item.getProperty("DUE") || item.getProperty("DTSTART"); except for this minor opt: var end = item.getProperty("DTEND") || item.getProperty("DUE") || dtstart; the patch looks good; thanks sebo!
Here is the second version with minor opt as requested. Nothing else changed.
Attachment #273334 - Attachment is obsolete: true
Attachment #273410 - Flags: review?(daniel.boelzle)
Attachment #271851 - Flags: review?(mvl)
Assignee: nobody → sebo.moz
Comment on attachment 273410 [details] [diff] [review] second modification v2 r=dbo
Attachment #273410 - Flags: review?(daniel.boelzle) → review+
Checked in on HEAD and MOZILLA_1_8_BRANCH.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → 0.7
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: