Fixed -hf flag not working correctly

pull/30/head
Hoffelhas 2023-01-08 17:37:24 +01:00
parent b2f2fa270e
commit 43e598a87a
1 changed files with 37 additions and 38 deletions

View File

@ -1156,48 +1156,47 @@ def autodoist_magic(args, api, connection):
# Remove labels based on start / due dates # Remove labels based on start / due dates
# If task is too far in the future, remove the next_action tag and skip #TODO: FIX THIS # If task is too far in the future, remove the next_action tag and skip #TODO: FIX THIS
# try: try:
# if args.hide_future > 0 and 'due' in task.data and task.due is not None: if args.hide_future > 0 and task.due.date is not None:
# due_date = datetime.strptime( due_date = datetime.strptime(
# task.due['date'][:10], "%Y-%m-%d") task.due.date, "%Y-%m-%d")
# future_diff = ( future_diff = (
# due_date - datetime.today()).days due_date - datetime.today()).days
# if future_diff >= args.hide_future: if future_diff >= args.hide_future:
# remove_label( remove_label(
# task, next_action_label, overview_task_ids, overview_task_labels) task, next_action_label, overview_task_ids, overview_task_labels)
# continue except:
# except: # Hide-future not set, skip
# # Hide-future not set, skip pass
# continue
# If start-date has not passed yet, remove label #TODO: FIX THIS # If start-date has not passed yet, remove label #TODO: FIX THIS
# try: try:
# f1 = task.content.find('start=') f1 = task.content.find('start=')
# f2 = task.content.find('start=due-') f2 = task.content.find('start=due-')
# if f1 > -1 and f2 == -1: if f1 > -1 and f2 == -1:
# f_end = task.content[f1+6:].find(' ') f_end = task.content[f1+6:].find(' ')
# if f_end > -1: if f_end > -1:
# start_date = task.content[f1 + start_date = task.content[f1 +
# 6:f1+6+f_end] 6:f1+6+f_end]
# else: else:
# start_date = task.content[f1+6:] start_date = task.content[f1+6:]
# # If start-date hasen't passed, remove all labels # If start-date hasen't passed, remove all labels
# start_date = datetime.strptime( start_date = datetime.strptime(
# start_date, args.dateformat) start_date, args.dateformat)
# future_diff = ( future_diff = (
# datetime.today()-start_date).days datetime.today()-start_date).days
# if future_diff < 0: if future_diff < 0:
# remove_label( remove_label(
# task, next_action_label, overview_task_ids, overview_task_labels) task, next_action_label, overview_task_ids, overview_task_labels)
# [remove_label(child_task, next_action_label, overview_task_ids, [remove_label(child_task, next_action_label, overview_task_ids,
# overview_task_labels) for child_task in child_tasks] overview_task_labels) for child_task in child_tasks]
# continue pass
# except: except:
# logging.warning( logging.warning(
# 'Wrong start-date format for task: "%s". Please use "start=<DD-MM-YYYY>"', task.content) 'Wrong start-date format for task: "%s". Please use "start=<DD-MM-YYYY>"', task.content)
# continue continue
# Recurring task friendly - remove label with relative change from due date #TODO FIX THIS # Recurring task friendly - remove label with relative change from due date #TODO FIX THIS
# try: # try: