mirror of https://github.com/Hoffelhas/autodoist
Bugfix where manually changing the order of sequential tasks would not remove old labels.
parent
97a7073f1c
commit
b2f2fa270e
25
autodoist.py
25
autodoist.py
|
@ -1019,6 +1019,12 @@ def autodoist_magic(args, api, connection):
|
||||||
hierarchy_boolean = [type(x) != type(None)
|
hierarchy_boolean = [type(x) != type(None)
|
||||||
for x in hierarchy_types]
|
for x in hierarchy_types]
|
||||||
|
|
||||||
|
# If task has no type, but has a label, most likely the order has been changed by user. Remove data.
|
||||||
|
if not True in hierarchy_boolean and next_action_label in task.labels:
|
||||||
|
remove_label(task, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
db_update_value(connection, task, 'task_type', None)
|
||||||
|
db_update_value(connection, task, 'parent_type', None)
|
||||||
|
|
||||||
# If it is a parentless task, set task type based on hierarchy
|
# If it is a parentless task, set task type based on hierarchy
|
||||||
if task.parent_id == 0:
|
if task.parent_id == 0:
|
||||||
if not True in hierarchy_boolean:
|
if not True in hierarchy_boolean:
|
||||||
|
@ -1043,6 +1049,10 @@ def autodoist_magic(args, api, connection):
|
||||||
if not first_found[1]:
|
if not first_found[1]:
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
elif next_action_label in task.labels:
|
||||||
|
# Probably the task has been manually moved, so if it has a label, let's remove it.
|
||||||
|
remove_label(task, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
elif dominant_type[1] == 'p':
|
elif dominant_type[1] == 'p':
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
@ -1052,6 +1062,10 @@ def autodoist_magic(args, api, connection):
|
||||||
if not first_found[1]:
|
if not first_found[1]:
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
elif next_action_label in task.labels:
|
||||||
|
# Probably the task has been manually moved, so if it has a label, let's remove it.
|
||||||
|
remove_label(task, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
elif dominant_type[1] == 'p':
|
elif dominant_type[1] == 'p':
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
@ -1060,6 +1074,10 @@ def autodoist_magic(args, api, connection):
|
||||||
if not first_found[1]:
|
if not first_found[1]:
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
elif next_action_label in task.labels:
|
||||||
|
# Probably the task has been manually moved, so if it has a label, let's remove it.
|
||||||
|
remove_label(task, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
elif dominant_type[0] == 'x' and dominant_type[1] == 'p':
|
elif dominant_type[0] == 'x' and dominant_type[1] == 'p':
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
@ -1068,6 +1086,10 @@ def autodoist_magic(args, api, connection):
|
||||||
if not first_found[1]:
|
if not first_found[1]:
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
if next_action_label in task.labels:
|
||||||
|
# Probably the task has been manually moved, so if it has a label, let's remove it.
|
||||||
|
remove_label(task, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
elif dominant_type[1] == 'x' and dominant_type[2] == 'p':
|
elif dominant_type[1] == 'x' and dominant_type[2] == 'p':
|
||||||
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
add_label(connection, task, dominant_type, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
|
@ -1099,6 +1121,9 @@ def autodoist_magic(args, api, connection):
|
||||||
if child_task.content.startswith('*'):
|
if child_task.content.startswith('*'):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
# Clean up for good measure.
|
||||||
|
remove_label(child_task, next_action_label, overview_task_ids, overview_task_labels)
|
||||||
|
|
||||||
# Pass task_type down to the children
|
# Pass task_type down to the children
|
||||||
db_update_value(
|
db_update_value(
|
||||||
connection, child_task, 'parent_type', dominant_type)
|
connection, child_task, 'parent_type', dominant_type)
|
||||||
|
|
Loading…
Reference in New Issue