From 1f2478fc1ba2fe9ba7a6b5c9a0fa8ea7329992dd Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 27 Jun 2023 22:55:46 +0100 Subject: [PATCH] Add list of packages affected by bulk support games --- app/blueprints/todo/user.py | 13 ++++++++++++- app/templates/todo/game_support.html | 19 +++++++++++-------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/blueprints/todo/user.py b/app/blueprints/todo/user.py index a127dd77..f8fbe31f 100644 --- a/app/blueprints/todo/user.py +++ b/app/blueprints/todo/user.py @@ -152,7 +152,18 @@ def all_game_support(username=None): Package.type.in_([PackageType.MOD, PackageType.TXP])) \ .order_by(db.asc(Package.title)).all() - return render_template("todo/game_support.html", user=user, packages=packages) + bulk_support_names = db.session.query(Package.title) \ + .select_from(Package).filter( + Package.maintainers.contains(user), + Package.state != PackageState.DELETED, + Package.type.in_([PackageType.MOD, PackageType.TXP]), + ~Package.supported_games.any(), + Package.supports_all_games == False) \ + .order_by(db.asc(Package.title)).all() + + bulk_support_names = ", ".join([x[0] for x in bulk_support_names]) + + return render_template("todo/game_support.html", user=user, packages=packages, bulk_support_names=bulk_support_names) @bp.route("/users//confirm_supports_all_games/", methods=["POST"]) diff --git a/app/templates/todo/game_support.html b/app/templates/todo/game_support.html index 502a64f8..b7de3cbd 100644 --- a/app/templates/todo/game_support.html +++ b/app/templates/todo/game_support.html @@ -63,12 +63,15 @@ {% endfor %} -

{{ _("Bulk support all games") }}

-

- {{ _("Click the button below to confirm that all packages without listed supported_games (red text above) do support all games, except for any games listed in unsupported_games.") }} -

-
- - -
+ {% if bulk_support_names %} +

{{ _("Bulk support all games") }}

+

+ {{ _("Click the button below to confirm that the following packages do support all games, except for any games listed in unsupported_games:") }} + {{ bulk_support_names }} +

+
+ + +
+ {% endif %} {% endblock %}