Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
tobixen committed Oct 20, 2023
1 parent 5362fa3 commit e268103
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions plann/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def _set_attr_options(verb="", desc=""):
@_set_attr_options('no', desc="select objects without")
@click.option('--start', help='do a time search, with this start timestamp')
@click.option('--begin', 'start', help='alias for start')
@click.option('--since', 'start', help='alias for start')
@click.option('--from', 'start', help='alias for start')
@click.option('--end', help='do a time search, with this end timestamp (or duration)')
@click.option('--to', 'end', help='alias for end')
Expand Down
11 changes: 7 additions & 4 deletions plann/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,13 @@ def _procrastinate(objs, delay, check_dependent="error", with_children=False, wi
i = x.icalendar_component
summary = _summary(i)
p = parent.icalendar_component
err_callback(f"{summary} could not be postponed due to parent {_summary(p)} with due {_ensure_ts(p['DUE'])} and priority {p.get('priority', 0)}")
if check_dependent == "interactive" and p.get('priority', 9)>2 and confirm_callback("procrastinate parent?"):
_procrastinate([parent], new_due+max(parent.get_duration(), datetime.timedelta(1)), check_dependent=check_dependent, err_callback=err_callback, confirm_callback=confirm_callback, recursivity=recursivity+1)
_procrastinate([x], new_due, check_dependent=check_dependent, err_callback=err_callback, confirm_callback=confirm_callback, recursivity=recursivity+1)
if p.get('STATUS') == 'COMPLETED':
_procrastinate([x], new_due, check_dependent=False, err_callback=err_callback, confirm_callback=confirm_callback, recursivity=recursivity+1)
else:
err_callback(f"{summary} could not be postponed due to parent {_summary(p)} with due {_ensure_ts(p['DUE'])} and priority {p.get('priority', 0)}")
if check_dependent == "interactive" and p.get('priority', 9)>2 and confirm_callback("procrastinate parent?"):
_procrastinate([parent], new_due+max(parent.get_duration()+x.get_duration()+datetime.timedelta(minutes=1), datetime.timedelta(minutes=1)), check_dependent=check_dependent, err_callback=err_callback, confirm_callback=confirm_callback, recursivity=recursivity+1)
_procrastinate([x], new_due, check_dependent=check_dependent, err_callback=err_callback, confirm_callback=confirm_callback, recursivity=recursivity+1)
elif check_dependent == "return":
return parent
else:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,6 @@ def test_adjust_ical_relations():
## parent list should be unchanged
assert(rels['PARENT'] == {'PARENT-A0', 'PARENT-A2', 'PARENT-B0', 'PARENT-B2'})
assert(rels['CHILD'] == {'CHILD-A0', 'CHILD-A1', 'CHILD-A2'})

#def test_split_vcal():
## TODO

0 comments on commit e268103

Please sign in to comment.