Add list of packages affected by bulk support games

This commit is contained in:
rubenwardy 2023-06-27 22:55:46 +01:00
parent 1a8d28a2d8
commit 1f2478fc1b
2 changed files with 23 additions and 9 deletions

@ -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/<username>/confirm_supports_all_games/", methods=["POST"])

@ -63,12 +63,15 @@
{% endfor %}
</div>
<h2>{{ _("Bulk support all games") }}</h2>
<p>
{{ _("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.") }}
</p>
<form method="post" action="{{ url_for('todo.confirm_supports_all_games', username=user.username) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" value="{{ _('Confirm') }}" class="btn btn-primary">
</form>
{% if bulk_support_names %}
<h2>{{ _("Bulk support all games") }}</h2>
<p>
{{ _("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 }}
</p>
<form method="post" action="{{ url_for('todo.confirm_supports_all_games', username=user.username) }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="submit" value="{{ _('Confirm') }}" class="btn btn-primary">
</form>
{% endif %}
{% endblock %}