diff --git a/toggl2sheets.py b/toggl2sheets.py index 18aee2b..4219428 100644 --- a/toggl2sheets.py +++ b/toggl2sheets.py @@ -114,12 +114,17 @@ def get_toggl_entries( # construct a dict of d["project name"] = [[date, description, duration (hours), wage], ...] out = defaultdict(list) for entry in reversed(entries): - if entry["duration"] <= 0 or entry["server_deleted_at"] is not None: - continue # running entries and deleted entries + if ( + entry["duration"] <= 0 # running entry + or entry["server_deleted_at"] is not None # deleted entry + or entry["project_id"] not in projects # entry not from selected workspace + ): + continue start = datetime.datetime.fromisoformat(entry["start"].replace("Z", "+00:00")) end = datetime.datetime.fromisoformat(entry["stop"].replace("Z", "+00:00")) if end <= last_edit: continue # get better accuracy than toggl lets us in their requests + out[projects[entry["project_id"]]].append( [ start.astimezone().strftime("%-d. %-m. %Y"),