mirror of https://github.com/Hoffelhas/autodoist
Decided to add a separate section loop to allow for a better flow of the logic. Initial start made, still needs to be fleshed out.
parent
6d3439019c
commit
a913c74086
15
autodoist.py
15
autodoist.py
|
@ -245,8 +245,6 @@ def main():
|
||||||
|
|
||||||
def get_type(object, key):
|
def get_type(object, key):
|
||||||
|
|
||||||
#TODO: API variable needs to be parsed to this function in order to make this work.
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
old_type = object[key]
|
old_type = object[key]
|
||||||
except:
|
except:
|
||||||
|
@ -303,7 +301,7 @@ def main():
|
||||||
return section_type, section_type_changed
|
return section_type, section_type_changed
|
||||||
|
|
||||||
def get_item_type(item, project_type, api):
|
def get_item_type(item, project_type, api):
|
||||||
"""Identifies how a item with sub items should be handled."""
|
"""Identifies how an item with sub items should be handled."""
|
||||||
|
|
||||||
if project_type is None and item['parent_id'] != 0:
|
if project_type is None and item['parent_id'] != 0:
|
||||||
try:
|
try:
|
||||||
|
@ -379,6 +377,8 @@ def main():
|
||||||
items = api.items.all(
|
items = api.items.all(
|
||||||
lambda x: x['project_id'] == project['id'])
|
lambda x: x['project_id'] == project['id'])
|
||||||
|
|
||||||
|
sections = [x['section_id'] for x in items] # better than api.sections.all(lambda x: x['project_id'] == project['id']), since then NoneTypes are not shown
|
||||||
|
|
||||||
# Change top parents_id in order to sort later on
|
# Change top parents_id in order to sort later on
|
||||||
for item in items:
|
for item in items:
|
||||||
if not item['parent_id']:
|
if not item['parent_id']:
|
||||||
|
@ -556,10 +556,11 @@ def main():
|
||||||
elif project_type == 'parallel' or project_type == 'p-s':
|
elif project_type == 'parallel' or project_type == 'p-s':
|
||||||
add_label(item, label_id)
|
add_label(item, label_id)
|
||||||
|
|
||||||
else:
|
if section_type:
|
||||||
# If no project-type has been defined
|
add_label(item, label_id)
|
||||||
if item_type:
|
|
||||||
add_label(item, label_id)
|
if item_type:
|
||||||
|
add_label(item, label_id)
|
||||||
|
|
||||||
# If there are children
|
# If there are children
|
||||||
if len(child_items) > 0:
|
if len(child_items) > 0:
|
||||||
|
|
Loading…
Reference in New Issue