From 5554c636d96570e489baf0dba85fce4a3d773f7f Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Fri, 4 Sep 2015 23:40:15 +0100 Subject: [PATCH] Stop removing/readding of next_action for future items. --- nextaction.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nextaction.py b/nextaction.py index 4ee39eb..f683d10 100755 --- a/nextaction.py +++ b/nextaction.py @@ -104,10 +104,11 @@ def main(): if args.hide_future > 0 and 'due_date_utc' in item.data and item['due_date_utc'] is not None: due_date = datetime.strptime(item['due_date_utc'], '%a %d %b %Y %H:%M:%S +0000') future_diff = (due_date - datetime.utcnow()).total_seconds() - if future_diff >= (args.hide_future * 86400) and label_id in labels: - labels.remove(label_id) - logging.debug('Updating %s without label as its too far in the future', item['content']) - item.update(labels=labels) + if future_diff >= (args.hide_future * 86400): + if label_id in labels: + labels.remove(label_id) + logging.debug('Updating %s without label as its too far in the future', item['content']) + item.update(labels=labels) continue # Process item