Skip to content

Commit

Permalink
🐛 Don’t include “Inbox”, it’ll duplicate entries
Browse files Browse the repository at this point in the history
  • Loading branch information
pmiddend committed Nov 23, 2020
1 parent 28003c5 commit 5848a03
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions orgtodoist/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 5848a03

Please sign in to comment.