1.1 --- a/imiptools/period.py Wed Mar 04 16:49:59 2015 +0100
1.2 +++ b/imiptools/period.py Wed Mar 04 17:06:11 2015 +0100
1.3 @@ -92,10 +92,23 @@
1.4 """
1.5
1.6 found = bisect_left(freebusy, (recurrenceid,))
1.7 - if found < len(freebusy):
1.8 + while found < len(freebusy):
1.9 start, end, _uid, transp, _recurrenceid = freebusy[found][:5]
1.10 - if start == recurrenceid and not _recurrenceid and uid == _uid:
1.11 +
1.12 + # Stop looking if the start no longer matches the recurrence identifier.
1.13 +
1.14 + if start != recurrenceid:
1.15 + return
1.16 +
1.17 + # If the period belongs to the parent object, remove it and return.
1.18 +
1.19 + if not _recurrenceid and uid == _uid:
1.20 del freebusy[found]
1.21 + break
1.22 +
1.23 + # Otherwise, keep looking for a matching period.
1.24 +
1.25 + found += 1
1.26
1.27 def get_overlapping(freebusy, period):
1.28