mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 09:17:10 +00:00
Fix Todoist custom project update (#17115)
* Fix Todoist custom project update Custom projects were not refreshing the API state and were using local/stored state. This resulted in invalid tasks being retained upon update. This change resets the local Todoist API state, syncs it, and then continues normal update operation(s) on the Todoist project data object. * Remove blank line after docstring * Update logging call * Simplify logging
This commit is contained in:
parent
5d6562a73f
commit
8fda705377
@ -518,6 +518,8 @@ class TodoistProjectData:
|
||||
def update(self):
|
||||
"""Get the latest data."""
|
||||
if self._id is None:
|
||||
self._api.reset_state()
|
||||
self._api.sync()
|
||||
project_task_data = [
|
||||
task for task in self._api.state[TASKS]
|
||||
if not self._project_id_whitelist or
|
||||
@ -527,6 +529,7 @@ class TodoistProjectData:
|
||||
|
||||
# If we have no data, we can just return right away.
|
||||
if not project_task_data:
|
||||
_LOGGER.debug("No data for %s", self._name)
|
||||
self.event = None
|
||||
return True
|
||||
|
||||
@ -541,6 +544,8 @@ class TodoistProjectData:
|
||||
|
||||
if not project_tasks:
|
||||
# We had no valid tasks
|
||||
_LOGGER.debug("No valid tasks for %s", self._name)
|
||||
self.event = None
|
||||
return True
|
||||
|
||||
# Make sure the task collection is reset to prevent an
|
||||
|
Loading…
x
Reference in New Issue
Block a user