From 77cc6a67558f4c12fb002b77d1b24311b49d602f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89milien=20Chapon?= Date: Fri, 10 Oct 2025 15:03:22 +0200 Subject: [PATCH] Fix use of get_chlidren --- viewer/functions/api.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/viewer/functions/api.py b/viewer/functions/api.py index 3741f6fce..c1670a243 100644 --- a/viewer/functions/api.py +++ b/viewer/functions/api.py @@ -303,15 +303,16 @@ def get_serial_numbers_for_site(site, verbose=False): flex_id = None bare_id = None - for child in mqdbt.db.local.get_children(localdb, component): - child_componentType = child.get("componentType", "") - child_id = child.get("_id") - if child_componentType == "module_pcb": - flex_id = child_id - elif child_componentType == "bare_module": - bare_id = child_id - if flex_id and bare_id: - break + for child in mqdbt.db.local.get_children( + localdb, component, component_type="module_pcb" + ): + flex_id = child.get("_id") + break + for child in mqdbt.db.local.get_children( + localdb, component, component_type="bare_module" + ): + bare_id = child.get("_id") + break flex = ( localdb.component.find_one({"_id": ObjectId(flex_id)}) -- GitLab