Skip to content

Commit

Permalink
style: clean up comments #259
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Nov 22, 2021
1 parent d211278 commit 94af185
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions datagateway_api/src/search_api/query_filter_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ def get_query_filter(request_filter):
if query_param_name == "filter":
log.debug("Filter: %s", request_filter["filter"])
for filter_name, filter_input in request_filter["filter"].items():
# {"where": {"property": "value"}}
# {"where": {"property": {"operator": "value"}}}
# {"where": {"text": "value"}}
# {"where": {"and": [{"property": "value"}, {"property": "value"}]}}
# {"where": {"or": [{"property": "value"}, {"property": "value"}]}}
if filter_name == "where":
if (
list(filter_input.keys())[0] == "and"
Expand Down Expand Up @@ -61,14 +56,6 @@ def get_query_filter(request_filter):
)

elif filter_name == "include":
# {"include": [{"relation": "relatedModel"}]}
#
# {"include": [{"relation": "relatedModel1"},
# {"relation": "relatedModel2"}]}
#
# {"include": [{"relation": "relatedModel",
# "scope": {"where": {"property": "value"}}}]}

for related_model in filter_input:
included_entity = related_model["relation"]
query_filters.append(SearchAPIIncludeFilter(included_entity))
Expand Down Expand Up @@ -141,12 +128,11 @@ def get_condition_values(filter_input):
filter_data = list(filter_input.values())[0]

if isinstance(filter_data, str):
# {"where": {"property": "value"}}
# Format: {"where": {"property": "value"}}
value = filter_input[field]
operation = "eq"
elif isinstance(filter_data, dict):
# {"where": {"property": {"operator": "value"}}}
print(f"filter data: {filter_data}")
# Format: {"where": {"property": {"operator": "value"}}}
value = list(filter_input[field].values())[0]
operation = list(filter_input[field].keys())[0]

Expand Down

0 comments on commit 94af185

Please sign in to comment.