Skip to content

Commit

Permalink
Merge branch 'feature/icat-include-filter-#143' into feature/distinct…
Browse files Browse the repository at this point in the history
…-filter-included-columns-#148
  • Loading branch information
MRichards99 committed Oct 9, 2020
2 parents f6df659 + a023678 commit 8b6cfad
Show file tree
Hide file tree
Showing 6 changed files with 337 additions and 326 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [yyyy] [name of copyright owner]
Copyright 2019 - Science and Technology Facilities Council – UK Research and Innovation

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
1 change: 0 additions & 1 deletion common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ def get_icat_properties(self):
properties_url = f"{config.get_icat_url()}/icat/properties"
r = requests.request("GET", properties_url, verify=config.get_icat_check_cert())
icat_properties = r.json()
log.debug("ICAT Properties: %s", icat_properties)

return icat_properties

Expand Down
1 change: 1 addition & 0 deletions common/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ class Constants:
DATABASE_URL = config.get_db_url()
ACCEPTED_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
PYTHON_ICAT_DISTNCT_CONDITION = "!= null"
ICAT_PROPERTIES = config.get_icat_properties()
5 changes: 3 additions & 2 deletions common/icat/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
)
from common.exceptions import FilterError
from common.config import config
from common.constants import Constants

log = logging.getLogger()

Expand All @@ -26,7 +27,7 @@ def apply_filter(self, query):
elif self.operation == "ne":
where_filter = self.create_condition(self.field, "!=", self.value)
elif self.operation == "like":
where_filter = self.create_condition(self.field, "like", self.value)
where_filter = self.create_condition(self.field, "like", f"%{self.value}%")
elif self.operation == "lt":
where_filter = self.create_condition(self.field, "<", self.value)
elif self.operation == "lte":
Expand Down Expand Up @@ -125,7 +126,7 @@ def __init__(self, skip_value):
super().__init__(skip_value)

def apply_filter(self, query):
icat_properties = config.get_icat_properties()
icat_properties = Constants.ICAT_PROPERTIES
icat_set_limit(query, self.skip_value, icat_properties["maxEntities"])


Expand Down
Loading

0 comments on commit 8b6cfad

Please sign in to comment.