Skip to content

Commit

Permalink
refactor with alex
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Sep 30, 2024
1 parent 574527c commit 69730bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
12 changes: 5 additions & 7 deletions openatlas/api/endpoints/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion openatlas/api/resources/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit 69730bc

Please sign in to comment.