2ccb018bdf
Players can create tours with selected courses/layouts and a date range. Others join via a 6-character tour code, play the courses, and report their total strokes. Live leaderboard with points and +/- par display. Includes: database schema, model, service, routes, views, and styling.
52 lines
1.9 KiB
Plaintext
52 lines
1.9 KiB
Plaintext
<% if (leaderboard.length === 0) { %>
|
|
<div class="card-section">
|
|
<p style="text-align: center; color: var(--text-secondary);">No players have joined yet. Share the tour link to get started!</p>
|
|
</div>
|
|
<% } else { %>
|
|
<div class="card-section">
|
|
<h3>Leaderboard</h3>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>Player</th>
|
|
<% courses.forEach(function(c) { %>
|
|
<th class="mobile-hide"><%= c.course_name %><br><small><%= c.layout_name %></small></th>
|
|
<% }); %>
|
|
<th>Points</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% var rank = 1; %>
|
|
<% leaderboard.forEach(function(player, i) { %>
|
|
<% if (i > 0 && player.total_points < leaderboard[i-1].total_points) rank = i + 1; %>
|
|
<tr>
|
|
<td><strong><%= rank %></strong></td>
|
|
<td>
|
|
<%= player.player_name %>
|
|
<span style="color: var(--text-muted); font-size: 12px;"><%= player.pdga_number %></span>
|
|
</td>
|
|
<% courses.forEach(function(c) { %>
|
|
<td class="mobile-hide">
|
|
<% var result = player.courses[c.tour_course_id]; %>
|
|
<% if (result) { %>
|
|
<span class="strokes"><%= result.total_strokes %></span>
|
|
<% if (result.relative_par > 0) { %>
|
|
<span class="over-par">(+<%= result.relative_par %>)</span>
|
|
<% } else if (result.relative_par < 0) { %>
|
|
<span class="under-par">(<%= result.relative_par %>)</span>
|
|
<% } else { %>
|
|
<span class="even-par">(E)</span>
|
|
<% } %>
|
|
<% } else { %>
|
|
<span style="color: var(--text-muted);">-</span>
|
|
<% } %>
|
|
</td>
|
|
<% }); %>
|
|
<td><strong><%= player.total_points %></strong></td>
|
|
</tr>
|
|
<% }); %>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<% } %> |