Verified every finding against the code, then fixed correctness (redirects, advancement reset, duplicate heats, high-jump attempt entry, placement ranking with tie handling, delete-dependency 500s), security (secrets out of config, config-driven admin seed, login lockout, role authorization with school scoping, heat-time IDOR, forwarded headers, last-admin guards), schema integrity (nullable+filtered ExistingStudentId, unique indexes for rounds/heats/bar heights via SchemaIntegrityFixes migration), performance (N+1 removal in high jump/reports/standings/dashboard, SQL-side student paging), and hygiene (duplicate notifications, auto-dismiss scope, local bootstrap-icons, orphaned files, test-data.sql tournament creation). FluentValidation is now registered; AutoMapper bumped to 14.0.0 (advisory fully patched only in licence-changed 15.1.1 — documented). 11 new tests; 63/63 passing. Credential rotation and deploy-time DB_CONNECTION_STRING are required manual follow-ups, documented in bug-fixes.md. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
133 lines
6.9 KiB
Plaintext
133 lines
6.9 KiB
Plaintext
@model IEnumerable<HighJumpHeightDto>
|
|
@{
|
|
ViewData["Title"] = "High Jump";
|
|
var telId = ViewBag.TournamentEventLevelId as int?;
|
|
var eventName = ViewBag.EventName as string;
|
|
var levelName = ViewBag.LevelName as string;
|
|
var registrations = ViewBag.Registrations as IEnumerable<EventRegistrationDto>;
|
|
var results = registrations?.Where(r => r.Score != null && r.Score.Placement != null)
|
|
.OrderBy(r => r.Score!.Placement)
|
|
.ToList() ?? new List<EventRegistrationDto>();
|
|
}
|
|
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<div>
|
|
<h2>High Jump Scoring</h2>
|
|
<p class="text-muted">@eventName - @levelName</p>
|
|
</div>
|
|
<div class="d-flex gap-2">
|
|
<form asp-action="AddHeight" method="post" class="d-flex gap-1">
|
|
<input type="hidden" name="TournamentEventLevelId" value="@telId" />
|
|
<input type="number" step="0.01" name="Height" placeholder="Height (m)" class="form-control form-control-sm" style="width:120px" />
|
|
<button type="submit" class="btn btn-sm btn-success">Add Height</button>
|
|
</form>
|
|
<form asp-action="CalculateResults" method="post">
|
|
<input type="hidden" name="tournamentEventLevelId" value="@telId" />
|
|
<button type="submit" class="btn btn-warning" onclick="return confirm('Calculate final results?')">Calculate Results</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm">
|
|
<div class="card-body p-0 table-responsive">
|
|
<table class="table table-bordered mb-0">
|
|
<thead class="table-dark">
|
|
<tr>
|
|
<th>Student</th>
|
|
<th>School</th>
|
|
@foreach (var height in Model.OrderBy(h => h.Height))
|
|
{
|
|
<th class="text-center" style="min-width:80px">
|
|
@height.Height.ToString("0.00")m
|
|
<form asp-action="RemoveHeight" method="post" class="d-inline">
|
|
<input type="hidden" name="heightId" value="@height.HighJumpHeightId" />
|
|
<input type="hidden" name="tournamentEventLevelId" value="@telId" />
|
|
<button type="submit" class="btn btn-link btn-sm text-danger p-0" onclick="return confirm('Remove?')">x</button>
|
|
</form>
|
|
</th>
|
|
}
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@if (registrations != null)
|
|
{
|
|
@foreach (var reg in registrations)
|
|
{
|
|
<tr>
|
|
<td>@reg.StudentName</td>
|
|
<td>@reg.SchoolName</td>
|
|
@foreach (var height in Model.OrderBy(h => h.Height))
|
|
{
|
|
var attempt = height.Attempts.FirstOrDefault(a => a.EventRegistrationId == reg.EventRegistrationId);
|
|
<td class="text-center">
|
|
@* One control per attempt slot, pre-selected with the recorded
|
|
result, so attempts 2 and 3 stay editable after attempt 1 is
|
|
saved (and mistakes can be corrected). *@
|
|
@for (int i = 1; i <= 3; i++)
|
|
{
|
|
var current = i == 1 ? attempt?.Attempt1 : i == 2 ? attempt?.Attempt2 : attempt?.Attempt3;
|
|
<form asp-action="RecordAttempt" method="post" class="d-inline">
|
|
<input type="hidden" name="tournamentEventLevelId" value="@telId" />
|
|
<input type="hidden" name="HighJumpHeightId" value="@height.HighJumpHeightId" />
|
|
<input type="hidden" name="EventRegistrationId" value="@reg.EventRegistrationId" />
|
|
<input type="hidden" name="AttemptNumber" value="@i" />
|
|
<select name="Result" onchange="this.form.submit()" class="form-select form-select-sm d-inline" style="width:52px">
|
|
<option value="" selected="@(current == null)">@i</option>
|
|
<option value="Clear" selected="@(current == HighJumpAttemptResult.Clear)">O</option>
|
|
<option value="Fail" selected="@(current == HighJumpAttemptResult.Fail)">X</option>
|
|
<option value="Pass" selected="@(current == HighJumpAttemptResult.Pass)">-</option>
|
|
</select>
|
|
</form>
|
|
}
|
|
@if (attempt?.IsEliminated == true) { <br/><span class="badge bg-danger">OUT</span> }
|
|
</td>
|
|
}
|
|
</tr>
|
|
}
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="card shadow-sm mt-4">
|
|
<div class="card-header d-flex justify-content-between align-items-center" style="background-color:#003366; color:white;">
|
|
<h5 class="mb-0">Results</h5>
|
|
<span class="small">Best cleared height ranks athletes; points use the World Athletics formula.</span>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
@if (results.Any())
|
|
{
|
|
<table class="table table-hover mb-0">
|
|
<thead class="table-dark">
|
|
<tr>
|
|
<th>Place</th>
|
|
<th>Student</th>
|
|
<th>School</th>
|
|
<th>Best Height</th>
|
|
<th>Points</th>
|
|
<th>Placement Pts</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach (var r in results)
|
|
{
|
|
<tr>
|
|
<td><span class="badge bg-warning text-dark">#@r.Score!.Placement</span></td>
|
|
<td>@r.StudentName</td>
|
|
<td>@r.SchoolName</td>
|
|
<td>@r.Score.RawPerformance.ToString("0.00")m</td>
|
|
<td>@r.Score.CalculatedPoints</td>
|
|
<td>@r.Score.PlacementPoints</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
}
|
|
else
|
|
{
|
|
<p class="text-muted p-3 mb-0">No results yet. Record clearances above, then click <strong>Calculate Results</strong> to rank athletes and award points.</p>
|
|
}
|
|
</div>
|
|
</div>
|