This commit is contained in:
bain 2022-08-28 01:14:24 +02:00
parent 89be8f3589
commit 4e39127952
No known key found for this signature in database
GPG key ID: A708F07AF3D92C02

View file

@ -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)