5kmrun-bg / 5kmrun-bg/fivekmrun-app
KidsRun: include Kids runs in the user's own runs list ("Твоите бягания")
- Lenguaje dominante
- Dart
- Estrellas
- 8
- Forks
- 7
- Merge medio
- 2 d 8 h
- PR fusionados (30 d)
- 30
Descripción
## Context
Follow-up to #185 (future KidsRun events), #186 (KidsRun results), and #187 (KidsRun profile stats). This issue covers including a user's own KidsRun participations in their personal runs list — the "Твоите бягания" screen (`lib/runs/user_runs_page.dart`) — alongside official and selfie runs. Mirrors XLrun #179.
## Current behavior
`RunsResource.getByUserId` (`lib/state/runs_resource.dart:55-75`) fetches official runs (`retrieve5kmRuns`, `api/5kmrun/user/`) and selfie runs (`retrieveSelfieRuns`, `api/selfie/user/`) and concatenates them into one `List`. Kids runs aren't fetched here, so a user's Kids participations are invisible in their own history.
## Endpoint
Same as #187: `GET https://5kmrun.bg/api/kidsrun/user/` — confirmed working. The `runners` array (current year) and each `years[n].results` array carry `r_id`/`r_eventid`/`r_finish_pos`/`r_time`/`n_name`/`e_date` — enough to build a `Run`.
**Avoid duplicating the fetch:** #187 needs this same endpoint for aggregate stats. Whichever lands first should design a shared `KidsUserResource`/`KidsRunsResource` so the other doesn't hit `kidsrun/user/` twice.
## What to build
- Add a `Run.fromKidsJson` constructor (parallel to `fromJson`/`fromSelfieJson` in `lib/state/run_model.dart:44,67`) and a `listFromKidsJson` from `runners` / flattened `years[].results`.
- Extend `RunsResource.getByUserId` to fetch and merge Kids runs alongside official and selfie.
- **Design note:** `Run.isSelfie` is a plain bool and every consumer branches on it (`runs_resource.dart` best/last logic, `user_runs_page.dart` border/label, `common/badges.dart`, `common/run_card.dart`). Adding kids as a second bool (`isKids`) compounds the problem — the same concern #179 raised for XL. Consider introducing a `RunType` enum (official/selfie/xl/kids) instead of stacking bools, and coordinate with #179 so XL and Kids share one refactor.
- Give Kids runs their own visual treatment in `UserRunsList`, consistent with the "Kids" badge from #185/#186 (don't reuse the selfie accent border).
- Distance is text-only in `n_name` (~2 km) — same parsing caveat as #186/#187.
- Decide whether Kids also gets `bestKidsRun`/`lastKidsRun` on `RunsResource` (only needed if home-screen run cards are extended to show a Kids card — not required here).
## Likely files touched
- `lib/state/run_model.dart` — `Run.fromKidsJson`, `listFromKidsJson`, and the `isSelfie`-vs-`RunType` decision.
- `lib/state/runs_resource.dart` — fetch + merge Kids runs in `getByUserId`.
- `lib/runs/user_runs_page.dart` — visual distinction for Kids entries.
## Related
- #185 — KidsRun future events.
- #186 — KidsRun results.
- #187 — KidsRun profile stats (**shares the `kidsrun/user/` endpoint** — coordinate to avoid duplicate fetches).
- XLrun #179 — same runs-list work for XL; coordinate the `RunType` refactor.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Evaluación
Este issue todavía no se ha evaluado.