Show feedback in the admin panel and as aggregate stats on the briefing page
Feedback was only ever written to session_setting rows with no way to view it short of querying the database directly. Adds a FeedbackService that pulls per-player feedback entries and aggregate averages, backing two new views: - /admin/feedback: a full table of every submission (game, session, player, ratings, comment) plus summary tiles, linked from the admin sidebar. - /briefing: a "Field Reports" block with the average difficulty/ entertainment/theme ratings, shown to prospective players. Free-text comments are deliberately left off this public page since they're unmoderated player input. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -101,6 +101,7 @@
|
||||
{ route: 'game_admin_users', label: 'Users', icon: '👤' },
|
||||
{ route: 'game_admin_games', label: 'Games', icon: '🎮' },
|
||||
{ route: 'game_admin_sessions', label: 'Sessions', icon: '▶' },
|
||||
{ route: 'game_admin_feedback', label: 'Feedback', icon: '💬' },
|
||||
{ route: 'game_admin_email_log', label: 'Email Log', icon: '✉' },
|
||||
] %}
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
{% extends 'game/admin/base.html.twig' %}
|
||||
|
||||
{% block title %}Feedback — Admin{% endblock %}
|
||||
|
||||
{% block admin_body %}
|
||||
<div style="display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem;">
|
||||
<h1 style="margin: 0; font-size: 1.5rem; color: #0f172a;">Feedback</h1>
|
||||
<span style="color: #64748b; font-size: 0.9rem;">{{ entries|length }} submission{{ entries|length != 1 ? 's' : '' }}</span>
|
||||
</div>
|
||||
|
||||
<div style="display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem;">
|
||||
{% set stats = [
|
||||
{ label: 'Submissions', value: summary.count, color: '#64748b' },
|
||||
{ label: 'Avg. Difficulty', value: summary.avgDifficulty is not null ? summary.avgDifficulty ~ '/10' : '—', color: '#3b82f6' },
|
||||
{ label: 'Avg. Entertainment', value: summary.avgEntertaining is not null ? summary.avgEntertaining ~ '/10' : '—', color: '#8b5cf6' },
|
||||
{ label: 'Avg. Theme', value: summary.avgTheme is not null ? summary.avgTheme ~ '/10' : '—', color: '#10b981' },
|
||||
] %}
|
||||
|
||||
{% for stat in stats %}
|
||||
<div style="
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
padding: 1.25rem;
|
||||
border-left: 4px solid {{ stat.color }};
|
||||
box-shadow: 0 1px 3px rgba(0,0,0,.07);
|
||||
">
|
||||
<div style="font-size: 1.75rem; font-weight: 700; color: {{ stat.color }};">{{ stat.value }}</div>
|
||||
<div style="font-size: 0.8rem; color: #64748b; margin-top: 0.25rem;">{{ stat.label }}</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div style="background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden;">
|
||||
<table style="width: 100%; min-width: 760px; border-collapse: collapse; font-size: 0.9rem;">
|
||||
<thead>
|
||||
<tr style="background: #f1f5f9; border-bottom: 1px solid #e2e8f0;">
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Game</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Session</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Player</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Difficulty</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Entertainment</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Theme</th>
|
||||
<th style="padding: 0.75rem 1rem; text-align: left; color: #475569; font-weight: 600;">Comment</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for entry in entries %}
|
||||
<tr style="border-bottom: 1px solid #f1f5f9;">
|
||||
<td style="padding: 0.75rem 1rem; font-weight: 500; color: #0f172a;">{{ entry.session.game.name }}</td>
|
||||
<td style="padding: 0.75rem 1rem;">
|
||||
<a href="{{ path('game_admin_view_session', {session: entry.session.id}) }}" style="color: #3b82f6; text-decoration: none;">#{{ entry.session.id }}</a>
|
||||
</td>
|
||||
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.player.user.username }}</td>
|
||||
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.difficulty ?? '—' }}</td>
|
||||
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.entertaining ?? '—' }}</td>
|
||||
<td style="padding: 0.75rem 1rem; color: #475569;">{{ entry.theme ?? '—' }}</td>
|
||||
<td style="padding: 0.75rem 1rem; color: #475569; max-width: 320px; white-space: pre-wrap;">{{ entry.text ?? '' }}</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="7" style="padding: 2rem; text-align: center; color: #94a3b8;">No feedback submitted yet.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -30,6 +30,17 @@
|
||||
color: var(--brand-teal-light, #6fb8d1);
|
||||
padding-right: .1em;
|
||||
}
|
||||
.briefing-feedback {
|
||||
background: rgba(111, 184, 209, .08);
|
||||
border: 1px solid #1c5a70;
|
||||
border-radius: .5rem;
|
||||
padding: 1.25rem;
|
||||
}
|
||||
.briefing-feedback-stat {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
color: #6fb8d1;
|
||||
}
|
||||
.dev-watermark-wrap {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
@@ -101,6 +112,34 @@
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{% if feedbackSummary.count > 0 %}
|
||||
<div class="briefing-feedback mb-4">
|
||||
<div class="text-uppercase small mb-3" style="letter-spacing: .1em; color: #6fb8d1;">
|
||||
Field Reports from {{ feedbackSummary.count }} Agent{{ feedbackSummary.count != 1 ? 's' : '' }}
|
||||
</div>
|
||||
<div class="row text-center g-3">
|
||||
{% if feedbackSummary.avgDifficulty is not null %}
|
||||
<div class="col-4">
|
||||
<div class="briefing-feedback-stat">{{ feedbackSummary.avgDifficulty }}/10</div>
|
||||
<div class="small" style="color: #9fc7d6;">Difficulty</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if feedbackSummary.avgEntertaining is not null %}
|
||||
<div class="col-4">
|
||||
<div class="briefing-feedback-stat">{{ feedbackSummary.avgEntertaining }}/10</div>
|
||||
<div class="small" style="color: #9fc7d6;">Entertainment</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if feedbackSummary.avgTheme is not null %}
|
||||
<div class="col-4">
|
||||
<div class="briefing-feedback-stat">{{ feedbackSummary.avgTheme }}/10</div>
|
||||
<div class="small" style="color: #9fc7d6;">Theme</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<hr class="my-4" style="border-color: #1c5a70;">
|
||||
|
||||
<div class="d-flex flex-wrap justify-content-between align-items-center gap-3">
|
||||
|
||||
Reference in New Issue
Block a user