mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
parent
8f453a8cdf
commit
71e68a6056
@ -17,7 +17,7 @@
|
|||||||
from typing import Optional, List
|
from typing import Optional, List
|
||||||
from flask import abort, current_app, request, make_response
|
from flask import abort, current_app, request, make_response
|
||||||
from flask_babel import lazy_gettext, gettext, get_locale
|
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.orm import subqueryload
|
||||||
from sqlalchemy.sql.expression import func
|
from sqlalchemy.sql.expression import func
|
||||||
from sqlalchemy_searchable import search
|
from sqlalchemy_searchable import search
|
||||||
@ -310,12 +310,9 @@ class QueryBuilder:
|
|||||||
query = query.filter(or_(Package.dev_state==None, Package.dev_state != PackageDevState.DEPRECATED))
|
query = query.filter(or_(Package.dev_state==None, Package.dev_state != PackageDevState.DEPRECATED))
|
||||||
|
|
||||||
if self.version:
|
if self.version:
|
||||||
query = query.join(Package.releases) \
|
query = query.filter(Package.releases.any(and_(or_(PackageRelease.min_rel_id==None,
|
||||||
.filter(PackageRelease.approved == True) \
|
PackageRelease.min_rel_id <= self.version.id), or_(PackageRelease.max_rel_id==None,
|
||||||
.filter(or_(PackageRelease.min_rel_id==None,
|
PackageRelease.max_rel_id >= self.version.id))))
|
||||||
PackageRelease.min_rel_id <= self.version.id)) \
|
|
||||||
.filter(or_(PackageRelease.max_rel_id==None,
|
|
||||||
PackageRelease.max_rel_id >= self.version.id))
|
|
||||||
|
|
||||||
return query
|
return query
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user