Mobilprofilen visar nu per vald klassom det finns depå,mellantids

decoders
This commit is contained in:
larssand
2026-08-25 20:04:14 +02:00
parent abf887dccd
commit 84302a770d
7 changed files with 81 additions and 2 deletions

View File

@@ -988,11 +988,14 @@ Analysis ownership is deliberately split into two pure functions:
|---|---|---|---|
| `buildSessionChannelStats(session, deps)` | `src/timing_logic.js` | one heat/session, grouped by competitor key | Timing, Race Setup, team standings, HTML reports, PDF reports |
| `buildDriverTimingChannelStats(state, driverId, classId)` | `src/training_logic.js` | one personal driver profile and selected class across sessions | Training detailed statistics |
| `buildPublicTimingChannelStats(state, classDriverIds)` | `server/public_training_profile.js` | sanitized aggregate for one shared profile class | public training profile API and mobile view |
`buildSessionChannelStats()` aggregates split count/best/average and pit count/total/best/average, and returns a chronological enriched pit-stop log. `renderSessionChannelAnalysis()` in `src/race_render_helpers.js` is the canonical HTML presentation. Do not independently recalculate these values in Timing or Race Setup.
`buildDriverTimingChannelStats()` resolves every driver record belonging to the same personal profile but applies the selected class filter before reading `resultsBySession`. Consequently multiple transponders in 2WD can be aggregated while 2WD and 4WD data remain separate.
The public builder repeats the class isolation on the server because the client must never receive the full state. Its output is limited to split count/best/average and pit count/total/best/average. It intentionally excludes transponders, competitor keys, driver IDs, event names, timestamps, and individual pit stops. Keep the serialization security assertion in `tests/public_training_profile.test.js` whenever this payload changes.
Presentation/data path:
```text
@@ -1004,6 +1007,10 @@ decoder_runtime -> resultsBySession[sessionId].splits/pitStops
resultsBySession -> buildDriverTimingChannelStats
-> Training / More statistics
resultsBySession -> buildPublicTimingChannelStats (server-side sanitized)
-> /public-training/api/:shareToken
-> personal mobile profile
```
Important invariants: