From efc6210b035fb61e7ade81677f7954aa730350c0 Mon Sep 17 00:00:00 2001 From: Orel Gueta Date: Thu, 25 Jan 2024 17:23:08 +0100 Subject: [PATCH] validate model name --- simtools/db_handler.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/simtools/db_handler.py b/simtools/db_handler.py index b2ea6f547..233ea5921 100644 --- a/simtools/db_handler.py +++ b/simtools/db_handler.py @@ -1446,7 +1446,7 @@ def get_all_versions( def get_all_available_telescopes( self, db_name=DB_CTA_SIMULATION_MODEL, - version="Released", + model_version="Released", ): """ Get all available telescope names in the collection "telescopes" in the DB. @@ -1455,7 +1455,7 @@ def get_all_available_telescopes( ---------- db_name: str the name of the DB - version: str + model_version: str Which version to get the telescopes of (default: "Released"). Returns @@ -1467,10 +1467,13 @@ def get_all_available_telescopes( collection = DatabaseHandler.db_client[db_name]["telescopes"] + _model_version = self._convert_version_to_tagged( + names.validate_model_version_name(model_version), + DatabaseHandler.DB_CTA_SIMULATION_MODEL, + ) + query = { - "Version": self._convert_version_to_tagged( - version, DatabaseHandler.DB_CTA_SIMULATION_MODEL - ), + "Version": _model_version, } _all_available_telescopes = collection.find(query).distinct("Telescope")