Skip to content
Snippets Groups Projects
Commit 07d3b23c authored by Martin Mareš's avatar Martin Mareš
Browse files

Odkaz na stažení všech řešení

Zatím jenom u celkové tabulky bodů.
parent 47c8afe2
No related branches found
No related tags found
2 merge requests!14Asynchronní joby,!9WIP: Zárodek uživatelské části webu a submitování
......@@ -16,6 +16,7 @@ import mo
import mo.csv
import mo.db as db
import mo.imports
import mo.jobs.submit
import mo.rights
from mo.rights import Right, Rights
import mo.util
......@@ -426,8 +427,8 @@ def make_contestant_table(query: Query, add_checkbox: bool = False, add_contest_
)
@app.route('/org/contest/c/<int:id>/reseni')
@app.route('/org/contest/c/<int:id>/site/<int:site_id>/reseni')
@app.route('/org/contest/c/<int:id>/reseni', methods=('GET', 'POST'))
@app.route('/org/contest/c/<int:id>/site/<int:site_id>/reseni', methods=('GET', 'POST'))
def org_contest_solutions(id: int, site_id: Optional[int] = None):
contest, site, rr = get_contest_site_rr(id, site_id, Right.manage_contest)
......@@ -456,6 +457,12 @@ def org_contest_solutions(id: int, site_id: Optional[int] = None):
joinedload(db.Solution.final_feedback_obj)
).all()
if request.method == 'POST' and 'download' in request.form:
paper_ids = [sol.final_submit for sol in sols if sol.final_submit is not None]
mo.jobs.submit.schedule_download_submits(paper_ids, 'Odevzdaná řešení', g.user)
flash('Příprava řešení ke stažení zahájena.', 'success')
return redirect(url_for('org_jobs'))
task_sols: Dict[int, Dict[int, db.Solution]] = {}
for t in tasks:
task_sols[t.task_id] = {}
......
......@@ -49,7 +49,6 @@ konkrétní úlohu.</p>
{% else %}–{% endif %}
<td class="sol">
{% else %}<td colspan=3><td>{% endif %}
<a class="btn btn-xs btn-link" title="Detail řešení" href="{{ url_for('org_submit_list', contest_id=contest.contest_id, user_id=u.user_id, task_id=task.task_id, site_id=site_id) }}">🔍</a>
{% endfor %}
<th>{{ sum_points|sum }}</th>
......@@ -57,4 +56,8 @@ konkrétní úlohu.</p>
{% endfor %}
</table>
<form method=POST action="">
<button type=submit name=download value=go>Stáhnout všechna řešení jako ZIP</button>
</form>
{% endblock %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment