Skip to content

Commit

Permalink
Now empty lists will be created in Todo Lists and closed projects won…
Browse files Browse the repository at this point in the history
…'t be returned
  • Loading branch information
Przemysław Szafrański committed Feb 1, 2025
1 parent 15916fd commit 7dae69a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions custom_components/ticktick/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ async def _async_update_data(self) -> list[ProjectWithTasks]:
for project in self._projects
]

projects_with_tasks = await asyncio.gather(*fetch_projects_with_tasks)

return projects_with_tasks
return await asyncio.gather(*fetch_projects_with_tasks)
except Exception as err:
raise UpdateFailed(f"Error communicating with API: {err}") from err

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ticktick/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
"issue_tracker": "/~https://github.com/Hantick/ticktick-home-assistant/issues",
"requirements": [],
"ssdp": [],
"version": "2.0.8",
"version": "2.0.9",
"zeroconf": []
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ async def get_projects(self, returnAsJson: bool = False) -> list[Project]:
mappedResponse = [Project.from_dict(project) for project in response]
filtered_projects = list(
filter(
lambda project: project.kind == Kind.TASK, mappedResponse
lambda project: project.kind == Kind.TASK and not project.closed,
mappedResponse,
) # Filtering out for now Notes
)
return filtered_projects
Expand Down Expand Up @@ -115,5 +116,5 @@ async def _get_response(
return {"status": "Success"}
return json_data
raise Exception( # noqa: TRY002
f"Unsucessful response from TickTick, status code: {response.status}"
f"Unsucessful response from TickTick, status code: {response.status}, content: {await response.json()}"
)
1 change: 1 addition & 0 deletions custom_components/ticktick/todo.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def __init__(
self._project_id = project_id
self._attr_unique_id = f"{config_entry_id}-{project_id}"
self._attr_name = project_name
self._attr_todo_items = []

@callback
def _handle_coordinator_update(self) -> None:
Expand Down

0 comments on commit 7dae69a

Please sign in to comment.