Wrong warning message was given for a different kind of wrong syntax; additional warning added.

master
Hoffelhas 2021-01-16 15:54:21 +01:00
parent 16d404a9ed
commit 17cc3a8418
1 changed files with 13 additions and 4 deletions

View File

@ -27,7 +27,7 @@ def make_wide(formatter, w=120, h=36):
def main(): def main():
# Version # Version
current_version = 'v1.4' current_version = 'v1.4.1'
"""Main process function.""" """Main process function."""
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
@ -471,6 +471,10 @@ def main():
for item in items: for item in items:
active_type = None # Reset active_type = None # Reset
# notes = api.notes.all() TODO: Quick notes test to see what the impact is?
# note_content = [x['content'] for x in notes if x['item_id'] == item['id']]
# print(note_content)
# Determine which child_items exist, both all and the ones that have not been checked yet # Determine which child_items exist, both all and the ones that have not been checked yet
non_checked_items = list( non_checked_items = list(
filter(lambda x: x['checked'] == 0, items)) filter(lambda x: x['checked'] == 0, items))
@ -712,7 +716,7 @@ def main():
except: except:
logging.warning( logging.warning(
'Wrong start-date format for item: %s. Please use "start=<DD-MM-YYYY>"', item['content']) 'Wrong start-date format for item: "%s". Please use "start=<DD-MM-YYYY>"', item['content'])
continue continue
# Recurring task friendly - remove label with relative change from due date # Recurring task friendly - remove label with relative change from due date
@ -729,8 +733,13 @@ def main():
else: else:
offset = item['content'][f+10:-1] offset = item['content'][f+10:-1]
item_due_date = item['due']['date'] try:
item_due_date = datetime.strptime(item_due_date, '%Y-%m-%d') item_due_date = item['due']['date']
item_due_date = datetime.strptime(item_due_date, '%Y-%m-%d')
except:
logging.warning('No due date to determine start date for item: "%s".', item['content'])
continue
if f1a != f1b and f1b > -1: # To make sure it doesn't trigger if 'w' is chosen if f1a != f1b and f1b > -1: # To make sure it doesn't trigger if 'w' is chosen
td = timedelta(days=int(offset)) td = timedelta(days=int(offset))
elif f2 > -1: elif f2 > -1: