Skip to content

Commit

Permalink
#828 fix filter by publicable and featured
Browse files Browse the repository at this point in the history
  • Loading branch information
D-GopalKrishna committed Dec 12, 2023
1 parent ee15aac commit 50c5eaf
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from cloudharness import log as logger
from cloudharness.service import pvc
from sqlalchemy import desc, or_
from sqlalchemy import desc, or_, and_
from sqlalchemy.sql import func


Expand Down Expand Up @@ -67,11 +67,15 @@ def search_qs(self, filter=None, q=None, tags=None, user_id=None, show_all=False
if tags:
q_base = q_base.intersect(self.filter_by_tags(tags, q_base))

q_base = q_base.filter(
or_(*[self._create_filter(*f) for f in filter if (f[0].key != "name" and f[0].key != "description")]))
q_base = self.filter_by_publicable_and_featured(filter, q_base)

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

def filter_by_publicable_and_featured(self, filter, q_base):
q_base = q_base.filter(
and_(*[self._create_filter(*f) for f in filter if (f[0].key == "publicable" or f[0].key == "featured")]))
return q_base

def filter_by_user_and_fieldkey(self, filter, user_id, show_all, q_base):
if filter and any(field for field, condition, value in filter if field.key == "publicable" and value):
pass
Expand Down

0 comments on commit 50c5eaf

Please sign in to comment.