From da3678c812081f9711691b774b40f92620ef8fff Mon Sep 17 00:00:00 2001 From: mrvladus Date: Thu, 12 Oct 2023 18:22:05 +0300 Subject: [PATCH] Refactor logs --- src/sync.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/sync.py b/src/sync.py index 33c1c657..966318c6 100644 --- a/src/sync.py +++ b/src/sync.py @@ -147,11 +147,15 @@ def _fetch(self): if task["id"] in caldav_ids and task["synced_caldav"]: for caldav_task in caldav_tasks: if caldav_task["id"] == task["id"]: - Log.debug(f"Update local task from {self.name}: {task['id']}") - task["text"] = caldav_task["text"] - task["parent"] = caldav_task["parent"] - task["completed"] = caldav_task["completed"] - task["color"] = caldav_task["color"] + updated: bool = False + for key in ["text", "parent", "completed", "color"]: + if task[key] != caldav_task[key]: + task[key] = caldav_task[key] + updated = True + if updated: + Log.debug( + f"Update local task from {self.name}: {task['id']}" + ) break # Delete local task that was deleted on CalDAV if task["id"] not in caldav_ids and task["synced_caldav"]: