fix: speedrun scores, dashboard icons, N+1 queries, typeof guards
This commit is contained in:
@@ -1,5 +1,18 @@
|
||||
# Changelog – helldivers-trainer
|
||||
|
||||
## [2.1.1] – 2026-03-31
|
||||
|
||||
### Fixed
|
||||
- **Speedrun scores never saved**: Individual scores were blocked by `if (mode !== 'speedrun')` guard; now saved per-stratagem like other modes. Final bulk-save with invalid `__speedrun__` stratagem name removed (was causing 400 errors).
|
||||
- **Dashboard recent-sessions icons missing**: `r.icon` was always `undefined` since the server doesn't store icon paths in the DB. Now looks up icon from `state.stratagems` by name.
|
||||
- **Variable shadowing in `renderDashboard`**: Outer `const r = eloRankFor(...)` was shadowed by `recent.map(r => ...)`. Renamed outer to `myRank`.
|
||||
- **N+1 DB queries in `broadcastLobbyUpdate`**: Was running one `SELECT elo` per online user. Now batches into a single `WHERE username IN (...)` query.
|
||||
- **N+1 DB queries in dashboard endpoint**: Same pattern fixed for the `/api/dashboard` online-users list.
|
||||
- **Unnecessary `typeof` guards**: `typeof u === 'object'` checks in lobby/dashboard removed — `lobby-update` always sends objects, never plain strings.
|
||||
- **Duplicate `else if (mode === 'endless')` branch in `nextStratagem`**: Was identical to the `else` branch below it; merged.
|
||||
|
||||
---
|
||||
|
||||
## [2.1.0] – 2026-03-31
|
||||
|
||||
### Added
|
||||
|
||||
Reference in New Issue
Block a user