Skip to content

Commit

Permalink
refactor: set get_condition_values to return tuple #259
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Bozhinov committed Dec 9, 2021
1 parent 3f4eaa6 commit 229a6c8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions datagateway_api/src/search_api/query_filter_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,13 @@ def get_where_filter(filter_input, entity_name):
filter_data = SearchAPIQueryFilterFactory.get_condition_values(
filter_input,
)
for condition in filter_data:
where_filters.append(
SearchAPIWhereFilter(
field=condition[0], value=condition[1], operation=condition[2],
),
)
where_filters.append(
SearchAPIWhereFilter(
field=filter_data[0],
value=filter_data[1],
operation=filter_data[2],
),
)

return where_filters

Expand Down Expand Up @@ -174,7 +175,6 @@ def get_include_filter(filter_input):

@staticmethod
def get_condition_values(filter_input):
where_filter_data = []
field = list(filter_input.keys())[0]
filter_data = list(filter_input.values())[0]

Expand All @@ -187,9 +187,7 @@ def get_condition_values(filter_input):
value = list(filter_input[field].values())[0]
operation = list(filter_input[field].keys())[0]

where_filter_data.append((field, value, operation))

return where_filter_data
return field, value, operation

@staticmethod
def prefix_where_filter_field_with_entity_name(where_filters, entity_name):
Expand Down

0 comments on commit 229a6c8

Please sign in to comment.