Add helpful page for game support

This commit is contained in:
rubenwardy
2022-06-25 00:32:32 +01:00
parent d6887d7b46
commit 7f00b77db3
7 changed files with 142 additions and 5 deletions

View File

@@ -506,8 +506,12 @@ class Package(db.Model):
def getSortedOptionalDependencies(self):
return self.getSortedDependencies(False)
def getSortedSupportedGames(self):
supported = self.supported_games.filter_by(supports=True).all()
def getSortedSupportedGames(self, include_unsupported=False):
query = self.supported_games
if not include_unsupported:
query = query.filter_by(supports=True)
supported = query.all()
supported.sort(key=lambda x: -(x.game.score + 100000*x.confidence))
return supported