Skip to content

Commit

Permalink
Fix engine version filtering breaking limit
Browse files Browse the repository at this point in the history
Fixes #383
  • Loading branch information
rubenwardy committed Jun 22, 2024
1 parent 8f453a8 commit 71e68a6
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions app/querybuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from typing import Optional, List
from flask import abort, current_app, request, make_response
from flask_babel import lazy_gettext, gettext, get_locale
from sqlalchemy import or_
from sqlalchemy import or_, and_
from sqlalchemy.orm import subqueryload
from sqlalchemy.sql.expression import func
from sqlalchemy_searchable import search
Expand Down Expand Up @@ -310,12 +310,9 @@ def filter_package_query(self, query):
query = query.filter(or_(Package.dev_state==None, Package.dev_state != PackageDevState.DEPRECATED))

if self.version:
query = query.join(Package.releases) \
.filter(PackageRelease.approved == True) \
.filter(or_(PackageRelease.min_rel_id==None,
PackageRelease.min_rel_id <= self.version.id)) \
.filter(or_(PackageRelease.max_rel_id==None,
PackageRelease.max_rel_id >= self.version.id))
query = query.filter(Package.releases.any(and_(or_(PackageRelease.min_rel_id==None,
PackageRelease.min_rel_id <= self.version.id), or_(PackageRelease.max_rel_id==None,
PackageRelease.max_rel_id >= self.version.id))))

return query

Expand Down

0 comments on commit 71e68a6

Please sign in to comment.