Indicate stuck releases in todo list and allow admins to delete them

This commit is contained in:
rubenwardy 2019-11-14 23:38:55 +00:00
parent 719a652235
commit 015abe5a25
3 changed files with 10 additions and 2 deletions

@ -19,7 +19,8 @@
<form method="post" action="" class="card-body"> <form method="post" action="" class="card-body">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" /> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<select name="action"> <select name="action">
<option value="importmodlist" selected>Import forum topics</option> <option value="delstuckreleases" selected>Delete stuck releases</option>
<option value="importmodlist">Import forum topics</option>
<option value="recalcscores">Recalculate package scores</option> <option value="recalcscores">Recalculate package scores</option>
<option value="checkusers">Check forum users</option> <option value="checkusers">Check forum users</option>
<option value="importscreenshots">Import screenshots from VCS</option> <option value="importscreenshots">Import screenshots from VCS</option>

@ -42,6 +42,9 @@
<ul class="list-group list-group-flush"> <ul class="list-group list-group-flush">
{% for r in releases %} {% for r in releases %}
<li class="list-group-item"> <li class="list-group-item">
{% if r.task_id %}
<span class="mr-2 badge badge-warning">Importing</span>
{% endif %}
<a href="{{ r.getEditURL() }}">{{ r.title }}</a> <a href="{{ r.getEditURL() }}">{{ r.title }}</a>
on on
<a href="{{ r.package.getDetailsURL() }}"> <a href="{{ r.package.getDetailsURL() }}">

@ -33,7 +33,11 @@ import datetime
def admin_page(): def admin_page():
if request.method == "POST": if request.method == "POST":
action = request.form["action"] action = request.form["action"]
if action == "importmodlist": if action == "delstuckreleases":
PackageRelease.query.filter(PackageRelease.task_id != None).delete()
db.session.commit()
return redirect(url_for("admin_page"))
elif action == "importmodlist":
task = importTopicList.delay() task = importTopicList.delay()
return redirect(url_for("check_task", id=task.id, r=url_for("todo_topics_page"))) return redirect(url_for("check_task", id=task.id, r=url_for("todo_topics_page")))
elif action == "checkusers": elif action == "checkusers":