Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/828 - Fix featured tabs #849

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice refactoring with TOP class naming!


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
Loading