Fix game support errors not showing to users

Fixes #394
This commit is contained in:
rubenwardy 2023-01-02 19:19:33 +00:00
parent 31a748b0b3
commit 65e8929689
2 changed files with 24 additions and 18 deletions

@ -667,15 +667,18 @@ def game_support(package):
detect_update_needed = False
if current_user not in package.maintainers:
resolver = GameSupportResolver(db.session)
try:
resolver = GameSupportResolver(db.session)
game_is_supported = {}
for game in get_games_from_csv(db.session, form.supported.data or ""):
game_is_supported[game.id] = True
for game in get_games_from_csv(db.session, form.unsupported.data or ""):
game_is_supported[game.id] = False
resolver.set_supported(package, game_is_supported, 11)
detect_update_needed = True
game_is_supported = {}
for game in get_games_from_csv(db.session, form.supported.data or ""):
game_is_supported[game.id] = True
for game in get_games_from_csv(db.session, form.unsupported.data or ""):
game_is_supported[game.id] = False
resolver.set_supported(package, game_is_supported, 11)
detect_update_needed = True
except LogicError as e:
flash(e.message, "danger")
next_url = package.getURL("packages.game_support")

@ -146,18 +146,21 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path):
# Update game support
if package.type == PackageType.MOD:
resolver = GameSupportResolver(db.session)
try:
resolver = GameSupportResolver(db.session)
game_is_supported = {}
if "supported_games" in tree.meta:
for game in get_games_from_csv(db.session, tree.meta["supported_games"]):
game_is_supported[game.id] = True
if "unsupported_games" in tree.meta:
for game in get_games_from_csv(db.session, tree.meta["unsupported_games"]):
game_is_supported[game.id] = False
game_is_supported = {}
if "supported_games" in tree.meta:
for game in get_games_from_csv(db.session, tree.meta["supported_games"]):
game_is_supported[game.id] = True
if "unsupported_games" in tree.meta:
for game in get_games_from_csv(db.session, tree.meta["unsupported_games"]):
game_is_supported[game.id] = False
resolver.set_supported(package, game_is_supported, 10)
resolver.update(package)
resolver.set_supported(package, game_is_supported, 10)
resolver.update(package)
except LogicError as e:
raise TaskError(e.message)
return tree