Skip to content

Commit 7dae69a

Browse files
author
Przemysław Szafrański
committed
Now empty lists will be created in Todo Lists and closed projects won't be returned
1 parent 15916fd commit 7dae69a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

custom_components/ticktick/coordinator.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ async def _async_update_data(self) -> list[ProjectWithTasks]:
5252
for project in self._projects
5353
]
5454

55-
projects_with_tasks = await asyncio.gather(*fetch_projects_with_tasks)
56-
57-
return projects_with_tasks
55+
return await asyncio.gather(*fetch_projects_with_tasks)
5856
except Exception as err:
5957
raise UpdateFailed(f"Error communicating with API: {err}") from err
6058

custom_components/ticktick/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
"issue_tracker": "https://github.com/Hantick/ticktick-home-assistant/issues",
1717
"requirements": [],
1818
"ssdp": [],
19-
"version": "2.0.8",
19+
"version": "2.0.9",
2020
"zeroconf": []
2121
}

custom_components/ticktick/ticktick_api_python/ticktick_api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ async def get_projects(self, returnAsJson: bool = False) -> list[Project]:
7575
mappedResponse = [Project.from_dict(project) for project in response]
7676
filtered_projects = list(
7777
filter(
78-
lambda project: project.kind == Kind.TASK, mappedResponse
78+
lambda project: project.kind == Kind.TASK and not project.closed,
79+
mappedResponse,
7980
) # Filtering out for now Notes
8081
)
8182
return filtered_projects
@@ -115,5 +116,5 @@ async def _get_response(
115116
return {"status": "Success"}
116117
return json_data
117118
raise Exception( # noqa: TRY002
118-
f"Unsucessful response from TickTick, status code: {response.status}"
119+
f"Unsucessful response from TickTick, status code: {response.status}, content: {await response.json()}"
119120
)

custom_components/ticktick/todo.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def __init__(
7878
self._project_id = project_id
7979
self._attr_unique_id = f"{config_entry_id}-{project_id}"
8080
self._attr_name = project_name
81+
self._attr_todo_items = []
8182

8283
@callback
8384
def _handle_coordinator_update(self) -> None:

0 commit comments

Comments
 (0)