1.1 --- a/imiptools/period.py Sun Oct 25 23:29:52 2015 +0100
1.2 +++ b/imiptools/period.py Sun Oct 25 23:41:59 2015 +0100
1.3 @@ -619,10 +619,10 @@
1.4 # Add a point and this event to the ending list.
1.5
1.6 end = to_timezone(p.get_end(), tzid)
1.7 - if not view_end or end < view_end:
1.8 - if not scale.has_key(end):
1.9 - scale[end] = [], []
1.10 - scale[end][1].append(p)
1.11 + end = view_end and min(end, view_end) or end
1.12 + if not scale.has_key(end):
1.13 + scale[end] = [], []
1.14 + scale[end][1].append(p)
1.15
1.16 return scale
1.17
1.18 @@ -779,6 +779,19 @@
1.19 for t in new_slots:
1.20 insort_left(slots, t)
1.21
1.22 +def remove_end_slot(slots, view_period):
1.23 +
1.24 + """
1.25 + Remove from 'slots' any slot situated at the end of the given 'view_period'.
1.26 + """
1.27 +
1.28 + end = view_period.get_end_point()
1.29 + if not end or not slots:
1.30 + return
1.31 + i = bisect_left(slots, (Point(end), None))
1.32 + if i < len(slots):
1.33 + del slots[i:]
1.34 +
1.35 def add_slots(slots, points):
1.36
1.37 """