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_idYesPrimary identifier
tournament_idAltFallback support
entrant_idYesEntrant to manage

APIs Used

  • to/event_entrant_army_get.php
  • to/event_entrant_army_link.php
  • to/event_entrant_army_unlink.php
  • armies/list_by_user.php
  • armies/create.php
  • units/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
  • Link existing army
  • Create/import new army
Non-registered
  • Import army
  • Manual creation

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

  1. User selects or creates army
  2. POST to link endpoint
  3. State reloads
  4. Pane switches to left

Unlink workflow

  1. User clicks unlink
  2. Confirmation required
  3. POST unlink
  4. 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