Skip to content

Commit

Permalink
fix: add logic to deal with PythonICATIncludeFilter that could be r…
Browse files Browse the repository at this point in the history
…elated for ICAT relations for non-related PaNOSC fields #268
  • Loading branch information
MRichards99 committed Jan 28, 2022
1 parent 68fa3b3 commit 29232c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions datagateway_api/src/datagateway_api/filter_order_handler.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import logging

from datagateway_api.src.datagateway_api.icat.filters import (
PythonICATIncludeFilter,
PythonICATLimitFilter,
PythonICATOrderFilter,
PythonICATSkipFilter,
)
from datagateway_api.src.search_api.query import SearchAPIQuery

log = logging.getLogger()

Expand Down Expand Up @@ -42,6 +44,13 @@ def apply_filters(self, query):
self.sort_filters()

for query_filter in self.filters:
# Using `type()` because we only want the Python ICAT version, don't want
# the code to catch objects that inherit from the class e.g.
# `SearchAPIIncludeFilter`
if type(query_filter) is PythonICATIncludeFilter and isinstance(
query, SearchAPIQuery,
):
query = query.icat_query.query
query_filter.apply_filter(query)

def merge_python_icat_limit_skip_filters(self):
Expand Down

0 comments on commit 29232c6

Please sign in to comment.