mirror of https://github.com/Hoffelhas/autodoist
Fixed bug with incorrect label recognition. Added new debug logging lines, and removed redundant ones
parent
a4ac562068
commit
4c421b7577
33
autodoist.py
33
autodoist.py
|
@ -421,7 +421,12 @@ def check_regen_mode(api, item, regen_labels_id):
|
||||||
'Multiple regeneration labels used! Please pick only one for item: "{}".'.format(item['content']))
|
'Multiple regeneration labels used! Please pick only one for item: "{}".'.format(item['content']))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
try:
|
||||||
regen_label_id = overlap[0]
|
regen_label_id = overlap[0]
|
||||||
|
except:
|
||||||
|
logging.debug(
|
||||||
|
'No regeneration label for item: %s' % item['content'])
|
||||||
|
regen_label_id = [0]
|
||||||
|
|
||||||
if regen_label_id == regen_labels_id[0]:
|
if regen_label_id == regen_labels_id[0]:
|
||||||
return 0
|
return 0
|
||||||
|
@ -430,9 +435,9 @@ def check_regen_mode(api, item, regen_labels_id):
|
||||||
elif regen_label_id == regen_labels_id[2]:
|
elif regen_label_id == regen_labels_id[2]:
|
||||||
return 2
|
return 2
|
||||||
else:
|
else:
|
||||||
label_name = api.labels.get_by_id(regen_label_id)['name']
|
# label_name = api.labels.get_by_id(regen_label_id)['name']
|
||||||
logging.debug(
|
# logging.debug(
|
||||||
'No regeneration label for item: %s' % label_name)
|
# 'No regeneration label for item: %s' % item['content'])
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
@ -462,13 +467,18 @@ def run_recurring_lists_logic(args, api, item, child_items, child_items_all, reg
|
||||||
# If no label, use general mode instead
|
# If no label, use general mode instead
|
||||||
if regen_mode is None:
|
if regen_mode is None:
|
||||||
regen_mode = args.regeneration
|
regen_mode = args.regeneration
|
||||||
|
logging.debug('Using general recurring mode \'%s\' for item: %s',
|
||||||
|
regen_mode, item['content'])
|
||||||
|
else:
|
||||||
|
logging.debug('Using recurring label \'%s\' for item: %s',
|
||||||
|
regen_mode, item['content'])
|
||||||
|
|
||||||
# Apply tags based on mode
|
# Apply tags based on mode
|
||||||
give_regen_tag = 0
|
give_regen_tag = 0
|
||||||
|
|
||||||
if regen_mode == 2: # Regen all
|
if regen_mode == 1: # Regen all
|
||||||
give_regen_tag = 1
|
give_regen_tag = 1
|
||||||
elif regen_mode == 3: # Regen if all sub-tasks completed
|
elif regen_mode == 2: # Regen if all sub-tasks completed
|
||||||
if not child_items:
|
if not child_items:
|
||||||
give_regen_tag = 1
|
give_regen_tag = 1
|
||||||
|
|
||||||
|
@ -527,8 +537,8 @@ def run_recurring_lists_logic(args, api, item, child_items, child_items_all, reg
|
||||||
api.items.update(item['id'])
|
api.items.update(item['id'])
|
||||||
|
|
||||||
except:
|
except:
|
||||||
logging.debug(
|
# logging.debug(
|
||||||
'Parent not recurring: %s' % item['content'])
|
# 'Parent not recurring: %s' % item['content'])
|
||||||
pass
|
pass
|
||||||
|
|
||||||
if args.regeneration is not None and item['parent_id'] != 0:
|
if args.regeneration is not None and item['parent_id'] != 0:
|
||||||
|
@ -542,8 +552,8 @@ def run_recurring_lists_logic(args, api, item, child_items, child_items_all, reg
|
||||||
for child_item in child_items_all:
|
for child_item in child_items_all:
|
||||||
child_item['r_tag'] = 1
|
child_item['r_tag'] = 1
|
||||||
except:
|
except:
|
||||||
logging.debug('Child not recurring: %s' %
|
# logging.debug('Child not recurring: %s' %
|
||||||
item['content'])
|
# item['content'])
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Contains all main autodoist functionalities
|
# Contains all main autodoist functionalities
|
||||||
|
@ -567,7 +577,8 @@ def autodoist_magic(args, api, label_id, regen_labels_id):
|
||||||
# Get project type
|
# Get project type
|
||||||
project_type, project_type_changed = get_project_type(
|
project_type, project_type_changed = get_project_type(
|
||||||
args, project)
|
args, project)
|
||||||
logging.debug('Project \'%s\' being processed as %s',
|
if project_type is not None:
|
||||||
|
logging.debug('Identified \'%s\' as %s type',
|
||||||
project['name'], project_type)
|
project['name'], project_type)
|
||||||
|
|
||||||
# Get all items for the project
|
# Get all items for the project
|
||||||
|
@ -593,6 +604,7 @@ def autodoist_magic(args, api, label_id, regen_labels_id):
|
||||||
# Get section type
|
# Get section type
|
||||||
section_type, section_type_changed = get_section_type(
|
section_type, section_type_changed = get_section_type(
|
||||||
args, section)
|
args, section)
|
||||||
|
if section_type is not None:
|
||||||
logging.debug('Identified \'%s\' as %s type',
|
logging.debug('Identified \'%s\' as %s type',
|
||||||
section['name'], section_type)
|
section['name'], section_type)
|
||||||
|
|
||||||
|
@ -681,6 +693,7 @@ def autodoist_magic(args, api, label_id, regen_labels_id):
|
||||||
# Check item type
|
# Check item type
|
||||||
item_type, item_type_changed = get_item_type(
|
item_type, item_type_changed = get_item_type(
|
||||||
args, item, project_type)
|
args, item, project_type)
|
||||||
|
if item_type is not None:
|
||||||
logging.debug('Identified \'%s\' as %s type',
|
logging.debug('Identified \'%s\' as %s type',
|
||||||
item['content'], item_type)
|
item['content'], item_type)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue