From 5848a03ea920cfa8e4f13c0f26e6520fdf92a411 Mon Sep 17 00:00:00 2001 From: Philipp Middendorf Date: Mon, 23 Nov 2020 08:37:26 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Don=E2=80=99t=20include=20?= =?UTF-8?q?=E2=80=9CInbox=E2=80=9D,=20it=E2=80=99ll=20duplicate=20entries?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- orgtodoist/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/orgtodoist/__init__.py b/orgtodoist/__init__.py index 5fa3658..a48c126 100644 --- a/orgtodoist/__init__.py +++ b/orgtodoist/__init__.py @@ -58,6 +58,8 @@ class TodoistItem(TypedDict): content: str due: Optional[TodoistDue] parent_id: Optional[int] + in_history: int + is_deleted: int class TodoistProject(TypedDict): @@ -107,11 +109,18 @@ def build_todoist_project_tree( [ build_todoist_item_tree(state["items"], item) for item in state["items"] - if item["project_id"] == project["id"] and item["parent_id"] is None + if item["project_id"] == project["id"] + and item["parent_id"] is None + and item["is_deleted"] != 1 + and item["in_history"] != 1 ], ) - return [build_todoist_project_tree(state, p) for p in state["projects"]] + return [ + build_todoist_project_tree(state, p) + for p in state["projects"] + if p["name"] != "Inbox" + ] def serialize_todoist_tree(t: TodoistTree) -> None: