# HG changeset patch # User Paul Boddie # Date 1445810089 -3600 # Node ID de1b9500ebbff4413c183d11e1ebd7acdd4df193 # Parent a16b801f59ac07738f635ad78d9f81103576905c Drop the scale point at any specified view period end point. diff -r a16b801f59ac -r de1b9500ebbf imiptools/period.py --- a/imiptools/period.py Sun Oct 25 21:06:02 2015 +0100 +++ b/imiptools/period.py Sun Oct 25 22:54:49 2015 +0100 @@ -590,7 +590,7 @@ def get_scale(periods, tzid, view_period=None): """ - Return an ordered time scale from the given list of 'periods'. + Return a time scale from the given list of 'periods'. The given 'tzid' is used to make sure that the times are defined according to the chosen time zone. @@ -619,10 +619,10 @@ # Add a point and this event to the ending list. end = to_timezone(p.get_end(), tzid) - end = view_end and min(end, view_end) or end - if not scale.has_key(end): - scale[end] = [], [] - scale[end][1].append(p) + if not view_end or end < view_end: + if not scale.has_key(end): + scale[end] = [], [] + scale[end][1].append(p) return scale