1.1 --- a/imiptools/period.py Sun Mar 01 22:00:09 2015 +0100
1.2 +++ b/imiptools/period.py Sun Mar 01 23:18:17 2015 +0100
1.3 @@ -62,9 +62,18 @@
1.4 return False
1.5
1.6 def insert_period(freebusy, period):
1.7 +
1.8 + "Insert into 'freebusy' the given 'period'."
1.9 +
1.10 insort_left(freebusy, period)
1.11
1.12 def remove_period(freebusy, uid, recurrenceid=None):
1.13 +
1.14 + """
1.15 + Remove from 'freebusy' all periods associated with 'uid' and 'recurrenceid'
1.16 + (which if omitted causes the "parent" object's periods to be referenced).
1.17 + """
1.18 +
1.19 i = 0
1.20 while i < len(freebusy):
1.21 t = freebusy[i]
1.22 @@ -74,6 +83,14 @@
1.23 i += 1
1.24
1.25 def remove_affected_period(freebusy, uid, recurrenceid):
1.26 +
1.27 + """
1.28 + Remove from 'freebusy' a period associated with 'uid' that provides an
1.29 + occurrence starting at the given 'recurrenceid', where the recurrence
1.30 + identifier is used to provide an alternative time period whilst also acting
1.31 + as a reference to the originally-defined occurrence.
1.32 + """
1.33 +
1.34 found = bisect_left(freebusy, (recurrenceid,))
1.35 if found < len(freebusy):
1.36 start, end, _uid, transp, _recurrenceid = freebusy[found][:5]