mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Refactors the API to used the new triggered functions
This commit is contained in:
13
pisa/api.py
13
pisa/api.py
@@ -109,17 +109,16 @@ class API:
|
|||||||
return jsonify(response)
|
return jsonify(response)
|
||||||
|
|
||||||
locator_map = self.watcher.db_manager.load_locator_map(locator)
|
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:
|
if locator_map is not None:
|
||||||
for uuid in locator_map:
|
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:
|
if appointment_data is not None:
|
||||||
# Triggered is an internal flag
|
appointment_data["status"] = "being_watched"
|
||||||
del appointment_data["triggered"]
|
response.append(appointment_data)
|
||||||
|
|
||||||
appointment_data["status"] = "being_watched"
|
|
||||||
response.append(appointment_data)
|
|
||||||
|
|
||||||
tracker_data = self.watcher.db_manager.load_responder_tracker(uuid)
|
tracker_data = self.watcher.db_manager.load_responder_tracker(uuid)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user