# HG changeset patch # User Paul Boddie # Date 1508096063 -7200 # Node ID 22a0b7b99d8f1124edb1663ab426913fed59ddfc # Parent 38ff4f58ae11240cee21f6afc869cfccd4cd0905 Preserve the main period in any expanded recurring period sequence. diff -r 38ff4f58ae11 -r 22a0b7b99d8f imiptools/data.py --- a/imiptools/data.py Sun Oct 15 18:39:24 2017 +0200 +++ b/imiptools/data.py Sun Oct 15 21:34:23 2017 +0200 @@ -1147,7 +1147,8 @@ # must start from the first period, filtering from a start date must be # done after the instances have been obtained. - for recurrence_start in selector.materialise(dtstart, end, parameters.get("COUNT"), parameters.get("BYSETPOS"), inclusive): + for recurrence_start in selector.materialise(dtstart, end, + parameters.get("COUNT"), parameters.get("BYSETPOS"), inclusive): # Determine the resolution of the period. @@ -1160,6 +1161,11 @@ period = RecurringPeriod(recurrence_start, recurrence_end, tzid, "RRULE", dtstart_attr) + # Use the main period where it occurs. + + if period == main_period: + period = main_period + # Filter out periods before the start. if period.within(selection_period):