Refactors the API to used the new triggered functions

This commit is contained in:
Sergi Delgado Segura
2020-01-09 18:15:43 +01:00
parent f6af67be87
commit d9cccfb26a

View File

@@ -109,15 +109,14 @@ 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:
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"]
if appointment_data is not None:
appointment_data["status"] = "being_watched"
response.append(appointment_data)