From 4e3912795262f6f2ac24d93cf2cd3ac8f3c46ed2 Mon Sep 17 00:00:00 2001 From: bain Date: Sun, 28 Aug 2022 01:14:24 +0200 Subject: [PATCH] bug fix --- toggl2sheets.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/toggl2sheets.py b/toggl2sheets.py index 4219428..937e000 100644 --- a/toggl2sheets.py +++ b/toggl2sheets.py @@ -109,7 +109,15 @@ def get_toggl_entries( f'Toggl responded with non-200 status code: {resp}, body: "{resp.text}"' ) entries = resp.json() - last_entry = next(filter(lambda x: x["duration"] > 0, entries), None) + last_entry = next( + filter( + lambda x: x["duration"] > 0 + and entry["server_deleted_at"] is None + and entry["project_id"] in projects, + entries, + ), + None, + ) # construct a dict of d["project name"] = [[date, description, duration (hours), wage], ...] out = defaultdict(list)