Fix unsupported games appearing in game hubs

Fixes #449
This commit is contained in:
rubenwardy 2023-06-27 20:41:07 +01:00
parent 870efc7fbe
commit 86565a0384
2 changed files with 3 additions and 3 deletions

@ -33,7 +33,7 @@ def game_hub(package: Package):
joinedload(Package.license),
joinedload(Package.media_license))
query = Package.query.filter(Package.supported_games.any(game=package), Package.state==PackageState.APPROVED)
query = Package.query.filter(Package.supported_games.any(game=package, supports=True), Package.state==PackageState.APPROVED)
count = query.count()
new = join(query.order_by(db.desc(Package.approved_at))).limit(4).all()
@ -43,7 +43,7 @@ def game_hub(package: Package):
.filter(Package.reviews.any()).limit(4).all()
updated = db.session.query(Package).select_from(PackageRelease).join(Package) \
.filter(Package.supported_games.any(game=package), Package.state==PackageState.APPROVED) \
.filter(Package.supported_games.any(game=package, supports=True), Package.state==PackageState.APPROVED) \
.order_by(db.desc(PackageRelease.releaseDate)) \
.limit(20).all()
updated = updated[:4]

@ -175,7 +175,7 @@ class QueryBuilder:
query = query.filter_by(author=author)
if self.game:
query = query.filter(Package.supported_games.any(game=self.game))
query = query.filter(Package.supported_games.any(game=self.game, supports=True))
for tag in self.tags:
query = query.filter(Package.tags.any(Tag.id == tag.id))