Files
ShooterHub/templates/analyses/detail.html

94 lines
3.7 KiB
HTML

{% extends "base.html" %}
{% block title %}{{ analysis.title }} — The Shooter's Network{% endblock %}
{% block content %}
<div style="display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:1rem;margin-bottom:1.5rem;">
<div>
<div style="font-size:0.82rem;color:#888;margin-bottom:.3rem;">
{% if analysis.session_id %}
<a href="{{ url_for('sessions.detail', session_id=analysis.session_id) }}">Session</a> &rsaquo;
{% else %}
<a href="{{ url_for('dashboard.index') }}">Dashboard</a> &rsaquo;
{% endif %}
Analysis
</div>
<h1 style="margin:0;">{{ analysis.title }}</h1>
<div style="font-size:0.85rem;color:#888;margin-top:.3rem;">
{{ analysis.created_at.strftime('%d %b %Y') }}
&nbsp;&middot;&nbsp; {{ analysis.shot_count }} shot(s)
&nbsp;&middot;&nbsp; {{ analysis.group_count }} group(s)
</div>
</div>
<div style="display:flex;gap:.75rem;align-items:center;flex-wrap:wrap;">
{% if has_pdf %}
<a href="{{ url_for('analyses.download_pdf', analysis_id=analysis.id) }}"
style="background:#1f77b4;color:#fff;border-radius:4px;padding:0.5rem 1.1rem;font-size:0.9rem;text-decoration:none;">
&#8659; Download PDF report
</a>
{% endif %}
{% if current_user.is_authenticated and current_user.id == analysis.user_id %}
<form method="post" action="{{ url_for('analyses.delete', analysis_id=analysis.id) }}"
onsubmit="return confirm('Delete this analysis? The CSV and PDF will be permanently removed.');">
<button type="submit"
style="background:#fff0f0;color:#c0392b;border:1px solid #f5c6c6;border-radius:4px;padding:0.5rem 1.1rem;font-size:0.9rem;cursor:pointer;">
Delete
</button>
</form>
{% endif %}
<a href="{{ url_for('analyze') }}" style="font-size:0.9rem;color:#666;">&#8592; New analysis</a>
</div>
</div>
<h2>Overall Statistics</h2>
<table style="max-width:480px;">
<thead>
<tr><th>Metric</th><th>Value</th></tr>
</thead>
<tbody>
<tr><td>Total shots</td><td>{{ overall.count }}</td></tr>
<tr><td>Min speed</td><td>{{ "%.4f"|format(overall.min_speed) }}</td></tr>
<tr><td>Max speed</td><td>{{ "%.4f"|format(overall.max_speed) }}</td></tr>
<tr><td>Mean speed</td><td>{{ "%.4f"|format(overall.mean_speed) }}</td></tr>
<tr>
<td>Std dev (speed)</td>
<td>
{% if overall.std_speed is not none %}{{ "%.4f"|format(overall.std_speed) }}{% else %}&ndash;{% endif %}
</td>
</tr>
</tbody>
</table>
<img class="chart-img" src="data:image/png;base64,{{ overview_chart }}"
alt="Avg speed and std dev per group" style="max-width:600px;margin:1rem 0 1.5rem;">
<h2>Groups &mdash; {{ groups_display|length }} group(s) detected</h2>
{% for stat, chart_b64 in groups_display %}
<div class="group-section">
<h3>Group {{ stat.group_index }}</h3>
<div class="group-meta">
{{ stat.time_start }} &ndash; {{ stat.time_end }} &nbsp;|&nbsp; {{ stat.count }} shot(s)
</div>
<table style="max-width:480px;">
<thead>
<tr><th>Metric</th><th>Value</th></tr>
</thead>
<tbody>
<tr><td>Min speed</td><td>{{ "%.4f"|format(stat.min_speed) }}</td></tr>
<tr><td>Max speed</td><td>{{ "%.4f"|format(stat.max_speed) }}</td></tr>
<tr><td>Mean speed</td><td>{{ "%.4f"|format(stat.mean_speed) }}</td></tr>
<tr>
<td>Std dev (speed)</td>
<td>
{% if stat.std_speed is not none %}{{ "%.4f"|format(stat.std_speed) }}{% else %}&ndash;{% endif %}
</td>
</tr>
</tbody>
</table>
<img class="chart-img" src="data:image/png;base64,{{ chart_b64 }}"
alt="Speed chart for group {{ stat.group_index }}">
</div>
{% endfor %}
{% endblock %}