Skip to content

Commit

Permalink
#828 comment for qfilters and removed unnecessary user_id check
Browse files Browse the repository at this point in the history
  • Loading branch information
D-GopalKrishna committed Dec 11, 2023
1 parent 0d76b3f commit 67857a0
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,12 @@ def get(self, id):

def search_qs(self, filter=None, q=None, tags=None, types=None, user_id=None):
q_base = self.model.query
if user_id is not None:
q_base = q_base.filter_by(user_id=user_id)

if filter is None:
if tags:
q_base = self.filter_by_tags(tags, q_base)
else:
q_base = self.filter_by_name_summary(filter, q_base)
# qfilter handles the search by name, summary, and user_id
q_base = self.filter_by_qfilters(filter, q_base)
q_base = self.filter_by_search_tags(filter, q_base)
if tags:
q_base = q_base.intersect(self.filter_by_tags(tags, q_base))
Expand All @@ -145,7 +143,7 @@ def search_qs(self, filter=None, q=None, tags=None, types=None, user_id=None):

return q_base.order_by(desc(OSBRepositoryEntity.timestamp_updated))

def filter_by_name_summary(self, filter, q_base):
def filter_by_qfilters(self, filter, q_base):
q_base = q_base.filter(
or_(*[self._create_filter(*f) for f in filter]))
return q_base
Expand Down

0 comments on commit 67857a0

Please sign in to comment.