mirror of https://github.com/Hoffelhas/autodoist
Skips all uncompletable tasks i.e. reference tasks
parent
c60f828baf
commit
e7bca36cb2
|
@ -57,6 +57,7 @@ def main():
|
||||||
log_level = logging.DEBUG
|
log_level = logging.DEBUG
|
||||||
else:
|
else:
|
||||||
log_level = logging.INFO
|
log_level = logging.INFO
|
||||||
|
# TODO add info log every x amount of time
|
||||||
logging.basicConfig(level=log_level)
|
logging.basicConfig(level=log_level)
|
||||||
|
|
||||||
# Check we have a API key
|
# Check we have a API key
|
||||||
|
@ -129,9 +130,10 @@ def main():
|
||||||
if project_type:
|
if project_type:
|
||||||
logging.debug('Project \'%s\' being processed as %s', project['name'], project_type)
|
logging.debug('Project \'%s\' being processed as %s', project['name'], project_type)
|
||||||
|
|
||||||
# Get all items for the project, sort by the item_order field.
|
# Get all items for the project
|
||||||
items = sorted(api.items.all(lambda x: x['project_id'] == project['id']),
|
items = api.items.all(lambda x: x['project_id'] == project['id'])
|
||||||
key=lambda x: x['child_order'])
|
|
||||||
|
first_found = False
|
||||||
|
|
||||||
for item in items:
|
for item in items:
|
||||||
|
|
||||||
|
@ -153,16 +155,18 @@ def main():
|
||||||
if item_type or len(child_items) > 0:
|
if item_type or len(child_items) > 0:
|
||||||
# Process serial tagged items
|
# Process serial tagged items
|
||||||
if item_type == 'serial':
|
if item_type == 'serial':
|
||||||
first_found = False
|
child_first_found = False
|
||||||
for child_item in child_items:
|
for child_item in child_items:
|
||||||
if child_item['checked'] == 0 and not first_found:
|
if child_item['checked'] == 0 and not child_first_found:
|
||||||
|
if not child_item['content'].startswith('*'):
|
||||||
add_label(child_item, label_id)
|
add_label(child_item, label_id)
|
||||||
first_found = True
|
child_first_found = True
|
||||||
else:
|
else:
|
||||||
remove_label(child_item, label_id)
|
remove_label(child_item, label_id)
|
||||||
# Process parallel tagged items or untagged parents
|
# Process parallel tagged items or untagged parents
|
||||||
else:
|
else:
|
||||||
for child_item in child_items:
|
for child_item in child_items:
|
||||||
|
if not child_item['content'].startswith('*'):
|
||||||
add_label(child_item, label_id)
|
add_label(child_item, label_id)
|
||||||
|
|
||||||
# Remove the label from the parent
|
# Remove the label from the parent
|
||||||
|
@ -172,11 +176,13 @@ def main():
|
||||||
else:
|
else:
|
||||||
if item['parent_id'] is None:
|
if item['parent_id'] is None:
|
||||||
if project_type == 'serial':
|
if project_type == 'serial':
|
||||||
if item['child_order'] == 1:
|
if not first_found and not item['content'].startswith('*'):
|
||||||
add_label(item, label_id)
|
add_label(item, label_id)
|
||||||
|
first_found = True
|
||||||
else:
|
else:
|
||||||
remove_label(item, label_id)
|
remove_label(item, label_id)
|
||||||
elif project_type == 'parallel':
|
elif project_type == 'parallel':
|
||||||
|
if not item['content'].startswith('*'):
|
||||||
add_label(item, label_id)
|
add_label(item, label_id)
|
||||||
|
|
||||||
if len(api.queue):
|
if len(api.queue):
|
||||||
|
|
Loading…
Reference in New Issue