From d9cccfb26acaf73583d1f2a0540df6ada0f1551b Mon Sep 17 00:00:00 2001 From: Sergi Delgado Segura Date: Thu, 9 Jan 2020 18:15:43 +0100 Subject: [PATCH] Refactors the API to used the new triggered functions --- pisa/api.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pisa/api.py b/pisa/api.py index 9468166..519b3cb 100644 --- a/pisa/api.py +++ b/pisa/api.py @@ -109,17 +109,16 @@ class API: return jsonify(response) locator_map = self.watcher.db_manager.load_locator_map(locator) + triggered_appointments = self.watcher.db_manager.load_all_triggered_flags() if locator_map is not None: for uuid in locator_map: - appointment_data = self.watcher.db_manager.load_watcher_appointment(uuid) + if uuid not in triggered_appointments: + appointment_data = self.watcher.db_manager.load_watcher_appointment(uuid) - if appointment_data is not None and appointment_data["triggered"] is False: - # Triggered is an internal flag - del appointment_data["triggered"] - - appointment_data["status"] = "being_watched" - response.append(appointment_data) + if appointment_data is not None: + appointment_data["status"] = "being_watched" + response.append(appointment_data) tracker_data = self.watcher.db_manager.load_responder_tracker(uuid)