mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 03:07:37 +00:00
Exclude Todoist sub-tasks for the todo platform (#104914)
This commit is contained in:
parent
35e2f591c1
commit
677c50a7cc
@ -85,6 +85,9 @@ class TodoistTodoListEntity(CoordinatorEntity[TodoistCoordinator], TodoListEntit
|
|||||||
for task in self.coordinator.data:
|
for task in self.coordinator.data:
|
||||||
if task.project_id != self._project_id:
|
if task.project_id != self._project_id:
|
||||||
continue
|
continue
|
||||||
|
if task.parent_id is not None:
|
||||||
|
# Filter out sub-tasks until they are supported by the UI.
|
||||||
|
continue
|
||||||
if task.is_completed:
|
if task.is_completed:
|
||||||
status = TodoItemStatus.COMPLETED
|
status = TodoItemStatus.COMPLETED
|
||||||
else:
|
else:
|
||||||
|
@ -46,6 +46,7 @@ def make_api_task(
|
|||||||
due: Due | None = None,
|
due: Due | None = None,
|
||||||
project_id: str | None = None,
|
project_id: str | None = None,
|
||||||
description: str | None = None,
|
description: str | None = None,
|
||||||
|
parent_id: str | None = None,
|
||||||
) -> Task:
|
) -> Task:
|
||||||
"""Mock a todoist Task instance."""
|
"""Mock a todoist Task instance."""
|
||||||
return Task(
|
return Task(
|
||||||
@ -61,7 +62,7 @@ def make_api_task(
|
|||||||
id=id or "1",
|
id=id or "1",
|
||||||
labels=["Label1"],
|
labels=["Label1"],
|
||||||
order=1,
|
order=1,
|
||||||
parent_id=None,
|
parent_id=parent_id,
|
||||||
priority=1,
|
priority=1,
|
||||||
project_id=project_id or PROJECT_ID,
|
project_id=project_id or PROJECT_ID,
|
||||||
section_id=None,
|
section_id=None,
|
||||||
|
@ -51,6 +51,14 @@ def set_time_zone(hass: HomeAssistant) -> None:
|
|||||||
],
|
],
|
||||||
"0",
|
"0",
|
||||||
),
|
),
|
||||||
|
(
|
||||||
|
[
|
||||||
|
make_api_task(
|
||||||
|
id="12345", content="sub-task", is_completed=False, parent_id="1"
|
||||||
|
)
|
||||||
|
],
|
||||||
|
"0",
|
||||||
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
async def test_todo_item_state(
|
async def test_todo_item_state(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user