Applied fix to the sequential label logic

master
Hoffelhas 2020-05-12 23:12:14 +02:00
parent 9dbbd87720
commit f021a84bf7
1 changed files with 3 additions and 3 deletions

View File

@ -144,7 +144,6 @@ def main():
logging.exception('Error trying to sync with Todoist API: %s' % str(e)) logging.exception('Error trying to sync with Todoist API: %s' % str(e))
else: else:
for project in api.projects.all(): for project in api.projects.all():
print(project.data['name'])
# Get project type # Get project type
project_type, project_type_changed = get_project_type(project) project_type, project_type_changed = get_project_type(project)
@ -236,7 +235,7 @@ def main():
# Add labels to top items if they have no childern # Add labels to top items if they have no childern
# if len(child_items) == 0: # if len(child_items) == 0:
if len(child_items) >= 0: if len(child_items) == 0:
if item['parent_id'] == 0: if item['parent_id'] == 0:
if project_type == 'serial': if project_type == 'serial':
if not first_found: if not first_found:
@ -262,7 +261,8 @@ def main():
# Process serial tagged items # Process serial tagged items
if item_type == 'serial': if item_type == 'serial':
for child_item in child_items: for child_item in child_items:
if child_item['checked'] == 0 and not child_first_found and label_id in item['labels']: if child_item['checked'] == 0 and not child_first_found and not first_found:
first_found = True
child_first_found = True child_first_found = True
add_label(child_item, label_id) add_label(child_item, label_id)
child_item['parent_type'] = item_type child_item['parent_type'] = item_type