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

Fix: Update beta logic and query to handle empty report_url #141

Merged
merged 2 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion spkrepo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ def version_string(self):

@hybrid_property
def beta(self):
return self.report_url != None # noqa: E711
return bool(self.report_url) # Treats None and "" as False

@hybrid_property
def all_builds_active(self):
Expand All @@ -484,6 +484,10 @@ def all_builds_active(cls):
.label("total_builds")
)

@beta.expression
def beta(cls):
return db.and_(cls.report_url.isnot(None), cls.report_url != "")

@property
def path(self):
return os.path.join(self.package.name, str(self.version))
Expand Down
4 changes: 3 additions & 1 deletion spkrepo/views/nas.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def get_catalog(arch, build, language, beta):
).select_from(Version)

if not beta:
latest_version = latest_version.filter(Version.report_url.is_(None))
latest_version = latest_version.filter(
db.or_(Version.report_url.is_(None), Version.report_url == "")
)

latest_version = (
latest_version.join(Build)
Expand Down
Loading