Add genlocke leg progression with advance endpoint and run context

When a run belonging to a genlocke is completed or failed, the genlocke
status updates accordingly. The run detail API now includes genlocke
context (leg order, total legs, genlocke name). A new advance endpoint
creates the next leg's run, and the frontend shows genlocke-aware UI
including a "Leg X of Y" banner, advance button, and contextual
messaging in the end-run modal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Julian Tabel
2026-02-09 09:47:28 +01:00
parent 96178622f9
commit 07343e94e2
11 changed files with 271 additions and 54 deletions

View File

@@ -80,8 +80,8 @@ A dedicated page showing:
- [x] The first leg starts automatically upon genlocke creation
- [ ] Each leg is a full nuzlocke run, tracked identically to standalone runs
- [ ] Completing a leg triggers a transfer step where surviving Pokemon can be carried forward
- [ ] Failing a leg marks the entire genlocke as failed
- [ ] Completing the final leg marks the genlocke as completed
- [x] Failing a leg marks the entire genlocke as failed
- [x] Completing the final leg marks the genlocke as completed
- [ ] A genlocke overview page shows progress, configuration, cumulative stats, lineage, and graveyard
- [ ] Transferred Pokemon appear as eggs (base form, level 1) in the next leg
- [ ] Pokemon lineage is trackable across multiple legs

View File

@@ -1,11 +1,11 @@
---
# nuzlocke-tracker-thbz
title: Genlocke leg progression
status: todo
status: in-progress
type: feature
priority: normal
created_at: 2026-02-09T07:42:33Z
updated_at: 2026-02-09T07:45:55Z
updated_at: 2026-02-09T08:42:15Z
parent: nuzlocke-tracker-25mh
blocking:
- nuzlocke-tracker-p74f
@@ -45,12 +45,12 @@ Handle the sequential progression of legs within a genlocke. When one leg is com
- After completion, redirect to the transfer step (or to the genlocke overview if it was the final leg)
## Checklist
- [ ] Add backend logic to detect when a completed/failed run belongs to a genlocke (query GenlockeLeg by run_id)
- [ ] On run completion: update GenlockeLeg status, determine if there's a next leg
- [ ] On run failure: mark the genlocke as failed, prevent further leg creation
- [ ] On final leg completion: mark the genlocke as completed
- [ ] Implement `POST /api/v1/genlockes/{id}/legs/{leg_order}/advance` endpoint to create the next leg's run
- [ ] Add genlocke context to the run detail API response (genlocke name, leg number, total legs) when the run belongs to a genlocke
- [ ] Update the frontend run page header to show "Leg X of Y — {Genlocke Name}" when applicable
- [ ] Update the run completion flow on the frontend to detect genlocke membership and redirect to transfer step instead of the standard completion screen
- [x] Add backend logic to detect when a completed/failed run belongs to a genlocke (query GenlockeLeg by run_id)
- [x] On run completion: update GenlockeLeg status, determine if there's a next leg
- [x] On run failure: mark the genlocke as failed, prevent further leg creation
- [x] On final leg completion: mark the genlocke as completed
- [x] Implement `POST /api/v1/genlockes/{id}/legs/{leg_order}/advance` endpoint to create the next leg's run
- [x] Add genlocke context to the run detail API response (genlocke name, leg number, total legs) when the run belongs to a genlocke
- [x] Update the frontend run page header to show "Leg X of Y — {Genlocke Name}" when applicable
- [x] Update the run completion flow on the frontend to detect genlocke membership and redirect to transfer step instead of the standard completion screen
- [ ] Handle edge case: what happens if a genlocke run is manually deleted?