Add per-exercise personal record tracking

Session tracking only ever stored a done boolean - no record of what
weight or reps were actually performed, so there was no way to derive
real progress data even though the dashboard implied "progress
tracking" was a thing. Workout templates only hold a static planned
value, not a history of performance.

Adds actual_weight/actual_reps to workout_session_items, captured
inline when checking off a set in a session (defaults to the workout's
planned weight/reps, editable before confirming). The exercise detail
page now shows the user's personal best (heaviest completed set, tie
broken by reps) computed from their completed session history across
all workouts containing that exercise.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-10 12:15:14 +03:00
co-authored by Claude Sonnet 5
parent 1cc21ad0c5
commit fa8bf46f8a
11 changed files with 248 additions and 2 deletions
+16
View File
@@ -79,6 +79,22 @@
</div>
</div>
<div class="lg:col-span-4">
@auth
<div class="rounded-2xl p-5 ring-1 ring-gray-200 dark:ring-gray-700 bg-white dark:bg-gray-800 mb-6">
<h3 class="text-sm font-semibold text-gray-900 dark:text-white">{{ __('app.exercises.personal_best') }}</h3>
@if($personalBest)
<div class="mt-2 flex items-baseline gap-2">
<span class="text-2xl font-extrabold text-gray-900 dark:text-white">{{ rtrim(rtrim(number_format($personalBest->actual_weight, 1), '0'), '.') }} kg</span>
@if($personalBest->actual_reps)
<span class="text-sm text-gray-600 dark:text-gray-300">&times; {{ $personalBest->actual_reps }} {{ __('app.sessions.reps') }}</span>
@endif
</div>
<p class="mt-1 text-xs text-gray-500">{{ optional($personalBest->session)->completed_at?->format('M j, Y') ?? $personalBest->updated_at->format('M j, Y') }}</p>
@else
<p class="mt-2 text-sm text-gray-600 dark:text-gray-300">{{ __('app.exercises.no_personal_best') }}</p>
@endif
</div>
@endauth
<div class="rounded-2xl p-5 ring-1 ring-gray-200 dark:ring-gray-700 bg-white dark:bg-gray-800">
<h3 class="text-sm font-semibold text-gray-900 dark:text-white">Exercise Info</h3>
<dl class="mt-3 space-y-2 text-sm text-gray-700 dark:text-gray-300">