Files
mtg-league/views/league.ejs
T
derekandClaude Opus 5.5 022d161934 One deck form per session; rename leagues; e2e test script
- A player's deck for a night is edited in a single form and written to
  their match rows and their standings row, so the two can't disagree.
  Matches, standings and hand imports all fill blank decks from the decks
  already entered, whatever order the files are imported in. The imported
  standings table shows decks read-only.
- Admins can rename a league.
- test/e2e.sh runs end-to-end checks against the local podman stack
  (fixtures by default, or real exports: test/e2e.sh sampledata).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 17:20:45 +00:00

17 lines
1.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<%- include('head') %>
<h1><%= lg.name %></h1>
<% if (admin) { %><form method="post" action="<%= base %>/admin/league/<%= lg.id %>/rename"><input name="name" value="<%= lg.name %>" required> <button>Rename league</button></form><% } %>
<h2>Leaderboard <small>(best <%= lg.best_n %> sessions)</small></h2>
<table><tr><th>#</th><th>Player</th><th>Counted</th><th>All sessions</th><th>Played</th><th>W-D-L</th><th>OMW%</th><th>GW%</th><th>OGW%</th></tr>
<% const pct = (r, k) => r.tb ? (r.tb[k] * 100).toFixed(2) : '–' %>
<% rows.forEach((r, i) => { %><tr><td><%= i + 1 %></td><td><%= r.name %></td><td><b><%= r.score %></b></td><td><%= r.total %></td>
<td><%= r.sessions %></td><td><%= r.rec ? r.rec.join('-') : '–' %></td>
<td><%= pct(r, 'omw') %></td><td><%= pct(r, 'gw') %></td><td><%= pct(r, 'ogw') %></td></tr><% }) %></table>
<p><small>Ties: total of all sessions, then Melee's tiebreakers (opponents' match-win %, game-win %, opponents' game-win %) over all league matches.</small></p>
<h2>Sessions</h2>
<ul><% sessions.forEach(g => { %><li><a href="<%= base %>/session/<%= g.id %>">Session <%= g.number %> – <%= g.date %></a></li><% }) %></ul>
<% if (admin) { %><form method="post" action="<%= base %>/admin/league/<%= lg.id %>/session"><input type="date" name="date" required> <button>New session</button></form><% } %>
<h2>Deck performance <small>(match W-D-L)</small></h2>
<table><tr><th>Deck</th><th>W-D-L</th></tr><% decks.forEach(([d, r]) => { %><tr><td><%= d %></td><td><%= r.join('-') %></td></tr><% }) %></table>
<% if (admin) { %><form method="post" action="<%= base %>/admin/league/<%= lg.id %>/delete" data-confirm="Delete this league and all its sessions and results? Players are kept."><button>Delete league</button></form><% } %>