Entrant Army Management
Link, create, import and manage an entrant’s primary army
TO
Workflow
Authenticated
/TO/event_entrant_armies.html
Source
/public_html/TO/event_entrant_armies.html[oai_citation:0‡event_entrant_armies.html](sediment://file_000000006c0871f4bb581ddf8a3720cd)/public_html/TO/scripts/event_entrant_armies.js[oai_citation:1‡event_entrant_armies.js](sediment://file_0000000065a07246b78c1fd1e57b4d28)
Purpose
- Assign exactly one primary army to an entrant
- Support both registered and non-registered entrants
- Allow linking, importing, or manual creation
- Provide live unit preview
Core business rule
Each entrant may have exactly one primary army.
- 0 armies → creation/linking allowed
- 1 army → only unlink allowed
URL parameters
| Parameter | Required | Notes |
|---|---|---|
| event_id | Yes | Primary identifier |
| tournament_id | Alt | Fallback support |
| entrant_id | Yes | Entrant to manage |
APIs Used
to/event_entrant_army_get.phpto/event_entrant_army_link.phpto/event_entrant_army_unlink.phparmies/list_by_user.phparmies/create.phpunits/list.php- Import endpoints (OWB / NR / SIC)
Page structure
- Entrant summary panel
- Left pane → current linked army
- Right pane → link/create/import options
Pane state model
| State | Left Pane | Right Pane |
|---|---|---|
| No army | Hidden | Active |
| Army linked | Active | Hidden |
Pane visibility is mutually exclusive and driven entirely by current state. [oai_citation:2‡event_entrant_armies.js](sediment://file_0000000065a07246b78c1fd1e57b4d28)
Entrant modes
| Type | Capabilities |
|---|---|
| Registered |
|
| Non-registered |
|
Import system
- Supports OWB, New Recruit, 2nd in Command
- Race/faction required for NR + SIC
- Optional debug mode shows unmatched units
Import → create army → link automatically
Manual creation
- Creates army via
armies/create.php - Requires race + faction
- Defaults name to "Event - Entrant"
Linking workflow
- User selects or creates army
- POST to link endpoint
- State reloads
- Pane switches to left
Unlink workflow
- User clicks unlink
- Confirmation required
- POST unlink
- Pane switches back to right
Units preview
- Loads via
units/list.php - Grouped by slot (Hero, Core, etc.)
- Sorted alphabetically
State model
{
event,
entrant,
primary_army
}
All UI behaviour derives from this state. [oai_citation:3‡event_entrant_armies.js](sediment://file_0000000065a07246b78c1fd1e57b4d28)
Validation rules
- Race required for import (NR/SIC)
- Faction required
- Scaling factor > 0
Debug support
- Displays unmatched units
- Shows normalization attempts
- Shows candidate matches
Risks / observations
- Very high complexity for a single page
- Multiple responsibilities combined
- Heavy reliance on correct API responses
- URL parameters must be valid
Recommended improvements
- Split into smaller components (link / import / preview)
- Add loading indicators
- Persist UI state between actions
- Improve error UX consistency
Architecture classification
This is a Stateful Workflow Controller:
- Manages multiple flows
- Maintains UI state
- Coordinates multiple APIs