Match time against all components

This commit is contained in:
Unrud 2017-06-09 02:30:32 +02:00 committed by Unrud
parent f5835cfe46
commit f9d299fbb9

View File

@ -289,7 +289,9 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn):
# if they are used. # if they are used.
# TODO: Single recurrences can be overwritten by components with # TODO: Single recurrences can be overwritten by components with
# RECURRENCE-ID (http://www.kanzaki.com/docs/ical/recurrenceId.html). They # RECURRENCE-ID (http://www.kanzaki.com/docs/ical/recurrenceId.html). They
# are currently ignored but can change the start and end time. # may overwrite the start and end time. Currently these components and
# the overwritten recurrences are both considered. The overwritten
# recurrence should be ignored instead.
def getrruleset(child): def getrruleset(child):
try: try:
@ -310,6 +312,7 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn):
# Comments give the lines in the tables of the specification # Comments give the lines in the tables of the specification
if child_name == "VEVENT": if child_name == "VEVENT":
for child in vobject_item.vevent_list:
# TODO: check if there's a timezone # TODO: check if there's a timezone
dtstart = child.dtstart.value dtstart = child.dtstart.value
@ -360,6 +363,7 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn):
return return
elif child_name == "VTODO": elif child_name == "VTODO":
for child in vobject_item.vtodo_list:
dtstart = getattr(child, "dtstart", None) dtstart = getattr(child, "dtstart", None)
duration = getattr(child, "duration", None) duration = getattr(child, "duration", None)
due = getattr(child, "due", None) due = getattr(child, "due", None)
@ -416,7 +420,8 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn):
# Line 2 # Line 2
due = reference_date + timedelta(seconds=original_duration) due = reference_date + timedelta(seconds=original_duration)
if (range_fn(reference_date, due) or if (range_fn(reference_date, due) or
range_fn(reference_date, reference_date + SECOND) or range_fn(reference_date,
reference_date + SECOND) or
range_fn(due - SECOND, due) or range_fn(due - SECOND, due) or
range_fn(due - SECOND, reference_date + SECOND)): range_fn(due - SECOND, reference_date + SECOND)):
return return
@ -449,6 +454,7 @@ def _visit_time_ranges(vobject_item, child_name, range_fn, infinity_fn):
return return
elif child_name == "VJOURNAL": elif child_name == "VJOURNAL":
for child in vobject_item.vjournal_list:
dtstart = getattr(child, "dtstart", None) dtstart = getattr(child, "dtstart", None)
if dtstart is not None: if dtstart is not None: