feat: add Phase 4 Logging & Tracking — inline set logging, history views
Add workout logging so users can track sets, reps, weight, and a
"felt easy?" toggle inline from the workout day view via HTMX.
Sessions auto-create on first log. History page shows past sessions
with detailed per-exercise breakdowns.
New services: WorkoutSessionService, LogService
New routes: POST /log, /log/{id}/edit, /log/{id}/delete, GET /history, /history/{id}
New templates: log_form, log_entry, session_card, log_history, session_detail
Modified: exercise_card (inline logging), nav (History link), workouts route (session context)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
23
app/templates/pages/log_history.html
Normal file
23
app/templates/pages/log_history.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Workout History -- SneakySwole{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<hgroup>
|
||||
<h1>Workout History</h1>
|
||||
{% if active_profile %}
|
||||
<p>History for: <strong>{{ active_profile.display_name }}</strong></p>
|
||||
{% else %}
|
||||
<p>No profile selected -- <a href="/profiles">select one</a></p>
|
||||
{% endif %}
|
||||
</hgroup>
|
||||
|
||||
{% if sessions %}
|
||||
{% for ws in sessions %}
|
||||
{% set day = days_by_id.get(ws.workout_day_id) %}
|
||||
{% include "partials/session_card.html" %}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p>No workout sessions recorded yet.</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
51
app/templates/pages/session_detail.html
Normal file
51
app/templates/pages/session_detail.html
Normal file
@@ -0,0 +1,51 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Session Detail -- SneakySwole{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<hgroup>
|
||||
{% set day = days_by_id.get(workout_session.workout_day_id) %}
|
||||
<h1>
|
||||
{{ day.name if day else "Workout" }}
|
||||
-- {{ workout_session.date.strftime('%B %d, %Y') }}
|
||||
</h1>
|
||||
{% if workout_session.notes %}
|
||||
<p>{{ workout_session.notes }}</p>
|
||||
{% endif %}
|
||||
</hgroup>
|
||||
|
||||
{% for exercise_id, logs in logs_by_exercise.items() %}
|
||||
{% set exercise = exercises_by_id[exercise_id] %}
|
||||
<article>
|
||||
<header>
|
||||
<h3>{{ exercise.name }}</h3>
|
||||
</header>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Set</th>
|
||||
<th>Reps</th>
|
||||
<th>Weight</th>
|
||||
<th>Easy?</th>
|
||||
<th>Notes</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for log in logs %}
|
||||
<tr>
|
||||
<td>{{ log.set_number }}</td>
|
||||
<td>{{ log.reps_completed }}</td>
|
||||
<td>{{ log.weight_used }}</td>
|
||||
<td>{{ "Yes" if log.felt_easy else "No" }}</td>
|
||||
<td>{{ log.notes or "" }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</article>
|
||||
{% else %}
|
||||
<p>No exercises logged in this session.</p>
|
||||
{% endfor %}
|
||||
|
||||
<a href="/history" role="button" class="outline">Back to History</a>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user