This commit is contained in:
larssand
2026-08-24 21:28:38 +02:00
parent 355a1ad3b0
commit 3aeb77a042
13 changed files with 642 additions and 8 deletions

View File

@@ -433,6 +433,10 @@ Owns:
- durable ledger synchronization from `resultsBySession`
- valid driver-lap aggregation across the training ledger
- lifetime/session/day/best-lap/average/consistency calculations
- active Open/Free/regular Practice statistics scoped to one driver and the current session start
- stint splitting after passing gaps greater than `120000 ms`
- best N consecutive laps and fixed-duration result calculation
- five-minute (`300000 ms`) results include the final lap when its start is before the cutoff and expose average pace for the counted laps
- daily summaries, controlled-lap streak, and recent personal-best gain
- rule-based practice recommendation selection
- automatic and custom milestone progress calculation
@@ -445,6 +449,11 @@ Rules:
- every save replaces ledger rows only for session IDs that still exist in `resultsBySession`
- ledger rows for a deleted session are retained and become historical records
- `sourceKey` deduplicates repeated saves of the same session passing
- a session change always starts a new stint
- a passing gap strictly greater than 2 minutes starts a new stint; exactly 2 minutes remains in the current stint
- a boundary lap whose `lapMs` contains the full break is excluded from pace metrics
- duration-result ranking compares lap count first and elapsed result time second
- a duration result is valid only after crossing the target and includes a final lap whose start is before the target cutoff
### `src/training_views.js`
Type:
@@ -456,6 +465,7 @@ Owns:
- progressive disclosure for goal/share administration, detailed history, and club comparison
- milestone/reward create, claim, and delete actions
- mobile-responsive training markup
- compact live-practice card and primary personal-profile action for the selected driver
Mutations:
- replaces or appends entries in `state.training.goals`
@@ -2081,6 +2091,9 @@ npm test
- per-driver isolation and day/session aggregation
- recommendation branch selection
- custom goal and automatic milestone progress
- selected-driver active-practice isolation, current-start filtering, and non-practice rejection
- two-minute stint boundaries, cross-session isolation, and boundary-lap exclusion
- best-three consecutive calculation and five-minute final-lap/average-pace behavior
`tests/public_training_profile.test.js` covers:
- enabled/disabled/unknown share-token handling
@@ -2132,6 +2145,12 @@ The suite uses Node's built-in `node:test` runner and does not add a test-framew
## 19. Recommended Future Additions
If the project grows further, the next useful additions to this document are:
- optional neural TTS provider integration for natural start, finish, and driver-name announcements
- backend-only provider credentials with no API key material in frontend state, exports, or public overlays
- server-side speech generation and content-addressed cache under `data/tts/` so race playback never waits for a cloud request
- cached audio invalidation when language, voice, phrase, or a driver's `speechName` changes
- offline fallback order: cached neural audio -> uploaded WAV/MP3 -> browser system voice -> passing beep
- provider health/status and a pre-generate-all-names action in Settings before race day
- exact `resultsBySession` competitor row schema
- exact `settings` schema snapshot
- SQLite table contract section