Record completed training sessions, credit them, and add session-count goals

A driver completing the practice timer, "Jämna varv", or "Stegträning"
now gets a permanent history entry instead of the outcome only existing
as a one-off notification - visible on both their mobile profile and
the admin Training page, so progress over past sessions is actually
reviewable. Each completion earns a prominent emoji-badged credit.

The completion is verified server-side against the driver's real
recorded laps before being saved, reusing the same progress builders
live tracking already uses - the client can only ask for a completion
to be checked and recorded, never supply the outcome itself, so a
driver can't fabricate a completed session (and the reward tied to it)
any more than they could fabricate a lap time.

Both per-driver and club-wide goals can now target "complete N
sessions of one exercise kind" as an alternative to "N laps", sharing
the existing reward/claim mechanism and forms.

Fixes a real bug found while building this: a pre-existing two-argument
wrapper around getTrainingGoalProgress in app.js silently dropped the
new third argument, so every sessions-metric goal displayed 0 progress
regardless of how many sessions were actually completed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
larssandandClaude Sonnet 5 committed 2026-09-09 20:43:47 +02:00
1 parent bed0dfd9f2
commit 1c4a06b69e
14 files changed
+800 -52

No files matched your search

+42
View File
@@ -417,6 +417,48 @@ button {
font-size: 0.7rem;
}
.profile-exercise-history {
display: grid;
gap: 8px;
margin: 12px 0 0;
padding: 0;
list-style: none;
}
.profile-exercise-history-row {
display: flex;
align-items: center;
min-width: 0;
gap: 10px;
padding: 9px;
border: 1px solid var(--line);
border-radius: 10px;
background: rgba(255, 255, 255, 0.025);
}
.profile-exercise-history-row > div {
min-width: 0;
}
.profile-exercise-history-emoji {
flex: 0 0 auto;
font-size: 1.3rem;
line-height: 1;
}
.profile-exercise-history-row strong,
.profile-exercise-history-row small {
display: block;
overflow: hidden;
text-overflow: ellipsis;
}
.profile-exercise-history-row small {
margin-top: 2px;
color: var(--muted);
font-size: 0.72rem;
}
.profile-card-head {
display: flex;
align-items: center;