1.1 --- a/imip_text_client.py Tue Dec 12 00:05:22 2017 +0100
1.2 +++ b/imip_text_client.py Tue Dec 12 00:10:43 2017 +0100
1.3 @@ -205,18 +205,16 @@
1.4 "Show period 'p' at 'index' with any indicated 'errors'."
1.5
1.6 errors = errors and errors.get(index)
1.7 - if p.replacement:
1.8 - if p.cancelled:
1.9 - label = "Cancelled"
1.10 - else:
1.11 - label = "Replaced"
1.12 + if p.cancelled:
1.13 + label = "Cancelled"
1.14 + elif p.replacement:
1.15 + label = "Replaced"
1.16 + elif p.new_replacement:
1.17 + label = "To replace"
1.18 + elif p.recurrenceid:
1.19 + label = "Retained"
1.20 else:
1.21 - if p.new_replacement:
1.22 - label = "To replace"
1.23 - elif p.recurrenceid:
1.24 - label = "Retained"
1.25 - else:
1.26 - label = "New"
1.27 + label = "New"
1.28
1.29 error_label = errors and " (errors: %s)" % ", ".join(errors) or ""
1.30 print "(%d) %s%s:" % (index, label, error_label), p.get_start(), p.get_end(), p.origin
1.31 @@ -442,7 +440,11 @@
1.32 if period:
1.33 edit_period(period, args)
1.34 period.cancelled = False
1.35 - period.origin = "DTSTART-RECUR"
1.36 +
1.37 + # Change the origin of modified rule periods.
1.38 +
1.39 + if period.origin == "RRULE":
1.40 + period.origin = "RDATE"
1.41
1.42 # Sort the periods after this change.
1.43
2.1 --- a/imiptools/editing.py Tue Dec 12 00:05:22 2017 +0100
2.2 +++ b/imiptools/editing.py Tue Dec 12 00:10:43 2017 +0100
2.3 @@ -635,7 +635,7 @@
2.4 # Make the status of the period compatible.
2.5
2.6 period.cancelled = False
2.7 - period.origin = "DTSTART-RECUR"
2.8 + period.origin = "RDATE"
2.9
2.10 # Either replace or add the period.
2.11
2.12 @@ -673,7 +673,6 @@
2.13 # Make replacements from existing periods and cancel them.
2.14
2.15 if p.recurrenceid:
2.16 - p.replacement = True
2.17 p.cancelled = cancelled
2.18
2.19 # Remove new periods completely.
2.20 @@ -1353,6 +1352,11 @@
2.21 if p.new_replacement:
2.22 p.new_replacement = False
2.23
2.24 + # Cancelled unedited periods.
2.25 +
2.26 + elif op:
2.27 + replaced.append(p)
2.28 +
2.29 # New periods without corresponding unedited periods.
2.30
2.31 elif p: