From 69730bcfe3d967437b333564437da5c706ab218b Mon Sep 17 00:00:00 2001 From: Bernhard Koschicek-Krombholz Date: Mon, 30 Sep 2024 17:57:29 +0200 Subject: [PATCH] refactor with alex --- openatlas/api/endpoints/parser.py | 12 +++++------- openatlas/api/resources/search.py | 2 +- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/openatlas/api/endpoints/parser.py b/openatlas/api/endpoints/parser.py index 09e2191d9..c1ff7ef87 100644 --- a/openatlas/api/endpoints/parser.py +++ b/openatlas/api/endpoints/parser.py @@ -84,7 +84,7 @@ def set_search_param(self) -> None: for category, value_list in item.items(): for values in value_list: values['logicalOperator'] = ( - values.get('logicalOperator') or 'or') + values.get('logicalOperator') or 'or') check_search_parameters(category, values) if check_if_date_search(category): try: @@ -95,19 +95,17 @@ def set_search_param(self) -> None: category, values["values"]) from e - for item in url_parameters: - for category, values in item.items(): - for parameter in values: self.search_param.append({ "search_values": get_search_values( category, - parameter), - "logical_operator": parameter['logicalOperator'], + values), + "logical_operator": values['logicalOperator'], "operator": 'equal' if category == "valueTypeID" - else parameter['operator'], + else values['operator'], "category": category, "is_date": check_if_date_search(category)}) + def search_filter(self, entity: Entity) -> bool: for i in self.search_param: if not search_entity( diff --git a/openatlas/api/resources/search.py b/openatlas/api/resources/search.py index 2ff5c2215..13e41ed8a 100644 --- a/openatlas/api/resources/search.py +++ b/openatlas/api/resources/search.py @@ -10,7 +10,7 @@ def get_search_values( category: str, - parameter: dict[str, Any]) -> list[str | int | list[Any]]: + parameter: dict[str, Any]) -> list[str | int | list[int]]: values = parameter["values"] match category: case "typeIDWithSubs":