Tournaments Page

Standings, analytics, player drill-down and export
Authenticated Analytics Complex UI
/app/tournaments.html

Source

  • /app/tournaments.html (HTML + JS) [oai_citation:0‡tournaments.html](sediment://file_00000000ac7871f489636a7abf759e1a)

Purpose

  • Display tournament standings
  • Show per-game tournament scoring
  • Provide army list analytics
  • Enable drill-through to game breakdowns
  • Support export to PDF

Primary API

  • tournaments/standings.php
Returns:
  • Tournaments
  • Standings
  • Games
  • Player lists
  • List summary analytics

Core features

  • Tournament selector dropdown
  • Standings table with dynamic round columns
  • Player drill-down modal (army list)
  • Army list analytics dashboard
  • PDF export:
    • Standings export
    • All lists export

Standings logic

  • Games sorted by:
    • tournament_round
    • ended_at
    • id
  • Columns:
    • Total Tournament Points (TP)
    • Total Victory Points (VP)
    • Per-round TP
  • Per-game cells link to: game_breakdown.html

Player drill-down modal

  • Triggered by clicking player name
  • Displays:
    • Army list
    • Unit breakdown
    • Flags (General / BSB)
    • Unit notes
    • Points by unit type

Army analytics

  • Race distribution
  • Faction distribution
  • Points by unit type
  • Most popular units
  • Average list points

Unit sorting rules

  • Order:
    • Hero
    • Core
    • Special
    • Rare
    • Mercenary
    • Ally
    • Other
  • Hero priority:
    • General first
    • BSB second
    • Alphabetical

Export functionality

  • Client-side print window generation
  • Formats HTML for print/PDF
  • Supports:
    • Standings report
    • All army lists

UX flow

  1. Page loads → calls standings API
  2. Dropdown populated
  3. User selects tournament
  4. Standings + analytics render
  5. User can:
    • Click players
    • Open modals
    • Export data

Dependencies

  • app_config.js
  • _api.js
  • Auth guard (requireAuthOrRedirect())

Risks / observations

  • Very large JS file (hard to maintain)
  • Multiple responsibilities:
    • Rendering
    • Sorting
    • Export logic
  • No modular separation yet
  • Heavy reliance on API payload shape

Recommended improvements

  • Split into:
    • tournaments.js
    • tournaments_render.js
    • tournaments_export.js
  • Introduce view-model layer
  • Cache API responses
  • Add loading skeleton UI

Architecture classification

This is a Composite Analytics Page:
  • Aggregates multiple data domains
  • Performs client-side transformation
  • Acts as reporting layer