From a6f9cbf44ea1adbd644a6d2dca4e6567bab684ea Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Thu, 26 Mar 2020 18:52:42 +0100 Subject: [PATCH] Prevents adding the same uuid twice in the map (appointment update) --- teos/watcher.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/teos/watcher.py b/teos/watcher.py index 79cb2b6..feb2f71 100644 --- a/teos/watcher.py +++ b/teos/watcher.py @@ -115,7 +115,9 @@ class Watcher: self.appointments[uuid] = {"locator": appointment.locator, "end_time": appointment.end_time} if appointment.locator in self.locator_uuid_map: - self.locator_uuid_map[appointment.locator].append(uuid) + # If the uuid is already in the map it means this is an update. + if uuid not in self.locator_uuid_map[appointment.locator]: + self.locator_uuid_map[appointment.locator].append(uuid) else: self.locator_uuid_map[appointment.locator] = [uuid]