feat: save guesses and show in admin page

This commit is contained in:
robin committed 2026-11-01 21:46:03 +01:00
1 parent 023152d417
commit 43185dee64
10 files changed
+414 -47

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
{% extends "base.html" %}
{% block title %}Auswertung – HörVergleich{% endblock %}
{% block content %}
<link rel="stylesheet" href="{{ url_for('static', filename='style/admin.css') }}">
<div class="admin-head">
<h2>Auswertung</h2>
<div class="admin-actions">
<a class="button" href="{{ url_for('main.admin_export') }}">CSV exportieren</a>
<form method="post" action="{{ url_for('main.admin_logout') }}">
<button type="submit" class="secondary">Abmelden</button>
</form>
</div>
</div>
<div class="stats">
<div class="stat"><span class="stat-value">{{ stats.people }}</span><span class="stat-label">Teilnehmer</span></div>
<div class="stat"><span class="stat-value">{{ stats.guesses }}</span><span class="stat-label">Bewertungen</span></div>
<div class="stat">
<span class="stat-value">{{ stats.quote ~ ' %' if stats.quote is not none else '–' }}</span>
<span class="stat-label">Original gewählt</span>
</div>
</div>
{% if not rows %}
<p class="empty">Noch keine Ergebnisse vorhanden.</p>
{% else %}
<div class="table-wrap">
<table>
<thead>
<tr>
<th>Name</th><th>Gestartet</th>
<th class="num">Bewertungen</th><th class="num">Original gewählt</th><th class="num">Quote</th>
</tr>
</thead>
<tbody>
{% for r in rows %}
<tr>
<td>{{ r.name }}</td>
<td class="muted">{{ r.started }}</td>
<td class="num">{{ r.total }}</td>
<td class="num">{{ r.right }}</td>
<td class="num">{{ r.quote }} %</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
<h3>Einzelergebnisse</h3>
{% for r in rows %}
<details class="person">
<summary>{{ r.name }} <span class="muted">({{ r.right }}/{{ r.total }}, {{ r.started }})</span></summary>
<div class="table-wrap">
<table>
<thead><tr><th>Song</th><th>Original gewählt</th><th>Wahl</th><th>Bearbeitung</th></tr></thead>
<tbody>
{% for g in r.guesses %}
<tr>
<td>{{ songs.get(g.song_id, g.song_id) }}</td>
<td>{{ 'ja' if g.right else 'nein' }}</td>
<td>{{ g.choice }}</td>
<td>{{ g.edit }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</details>
{% endfor %}
{% endif %}
{% endblock %}