From 346702b90450aa1f2539bfdfdd2f711052f722a2 Mon Sep 17 00:00:00 2001 From: Hoffelhas Date: Wed, 30 Dec 2020 01:32:17 +0100 Subject: [PATCH] Debug header_items --- autodoist.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/autodoist.py b/autodoist.py index b299e8a..3c5299e 100644 --- a/autodoist.py +++ b/autodoist.py @@ -370,6 +370,17 @@ def main(): # To determine if a sequential task was found first_found_project = False + # Check if we need to (un)header entire project + header_project = False + unheader_project = False + + if project['name'][:2] == '**': + header_project = True + project.update(name=project['name'][3:]) + if project['name'][:2] == '!*': + unheader_project = True + project.update(name=project['name'][3:]) + if label_id is not None: # Get project type project_type, project_type_changed = get_project_type(project) @@ -413,6 +424,8 @@ def main(): x['parent_id'], x['child_order'])) items = list( filter(lambda x: not x['content'].startswith('*'), items)) + header_items = list( + filter(lambda x: x['content'].startswith('*'), items)) if label_id is not None: # If some type has been changed, clean everything for good measure @@ -422,6 +435,15 @@ def main(): # Remove parent types for item in items: item['parent_type'] = None + + for items in header_items: + # Logic for applying headers + if header_project is True: #TODO add section or item + if item['content'][0] != '*': + item.update(content='* ' + item['content']) + if unheader_project is True: #TODO add section or item + if item['content'][0] == '*': + item.update(content=item['content'][3:]) # For all items in this section for item in items: @@ -434,7 +456,7 @@ def main(): filter(lambda x: x['parent_id'] == item['id'], items)) child_items = list( filter(lambda x: x['parent_id'] == item['id'], non_checked_items)) - + # Logic for recurring lists if not args.recurring: try: