# HG changeset patch # User Paul Boddie # Date 1516386396 -3600 # Node ID 67b04224b4d61805bc4cdfe1b6b8799403d08546 # Parent 2039e5ca26b50925138f48859a5599b565491e5a Changed the criteria for whole event redefinitions by attendees, considering modified main periods instead of newly-replaced periods. diff -r 2039e5ca26b5 -r 67b04224b4d6 imiptools/editing.py --- a/imiptools/editing.py Thu Jan 18 22:00:14 2018 +0100 +++ b/imiptools/editing.py Fri Jan 19 19:26:36 2018 +0100 @@ -1434,6 +1434,8 @@ active_periods = new + replaced + retained active_non_rule = filter(lambda p: p.origin != "RRULE", active_periods) + main_modified = get_main_period(modified) + # Modified replaced recurrences are used for incremental updates. replaced_modified = select_recurrences(replaced, modified).values() @@ -1442,11 +1444,6 @@ replaced_unmodified = subtract_recurrences(replaced, modified).values() - # Determine any new replacement periods. These are edited periods that were - # not previously replacements. - - replaced_new = filter(lambda p: p.new_replacement, replaced) - # Obtain the removed periods in terms of existing periods. These are used in # incremental updates. @@ -1516,23 +1513,33 @@ to_add = [] # Parent event changes cause redefinition of the entire event. - # The event is defined in terms of new periods and exceptions for - # removed periods or obsolete rule periods. + + # New, removed, reinstated periods cannot be expressed as counter- + # proposals individually and so cause the entire event to be expressed + # as a counter-proposal. - if new or removed or is_changed or reinstated or replaced_new: + # Main period changes can only be sensibly expressed as a counter- + # proposal by expressing the entire event as such. + + if new or removed or is_changed or main_modified or reinstated or \ + reinstated_attendance: + + # The event is defined in terms of new periods and exceptions for + # removed periods or obsolete rule periods. + to_set = active_non_rule to_exclude = list(chain(cancelled, obsolete_rule, cancelled_main)) to_reschedule = [] all_unscheduled = [] all_rescheduled = [] - # Changed periods without new or removed periods are proposed as + # Changed but not new, removed or reinstated periods are proposed as # separate changes. else: to_set = [] to_exclude = [] - to_reschedule = replaced_modified + to_reschedule = list(chain(replaced_modified, replaced_modified_attendance)) all_unscheduled = cancelled_unmodified all_rescheduled = list(chain(replaced_unmodified, to_reschedule))