1.1 --- a/imiptools/period.py Wed Jan 28 14:29:24 2015 +0100
1.2 +++ b/imiptools/period.py Wed Jan 28 16:43:04 2015 +0100
1.3 @@ -267,8 +267,9 @@
1.4
1.5 for point, active in slots:
1.6 for t in active:
1.7 - if t:
1.8 - start, end, uid = t[:3]
1.9 + if t and len(t) >= 2:
1.10 + start, end, uid, key = get_freebusy_details(t)
1.11 +
1.12 try:
1.13 start_slot = points.index(start)
1.14 except ValueError:
1.15 @@ -277,8 +278,27 @@
1.16 end_slot = points.index(end)
1.17 except ValueError:
1.18 end_slot = len(slots)
1.19 - spans[uid] = end_slot - start_slot
1.20 + spans[key] = end_slot - start_slot
1.21
1.22 return spans
1.23
1.24 +def get_freebusy_details(t):
1.25 +
1.26 + "Return a tuple of the form (start, end, uid, key) from 't'."
1.27 +
1.28 + # Handle both complete free/busy details...
1.29 +
1.30 + if len(t) > 2:
1.31 + start, end, uid = t[:3]
1.32 + key = uid
1.33 +
1.34 + # ...and published details without specific event details.
1.35 +
1.36 + else:
1.37 + start, end = t[:2]
1.38 + uid = None
1.39 + key = (start, end)
1.40 +
1.41 + return start, end, uid, key
1.42 +
1.43 # vim: tabstop=4 expandtab shiftwidth=4