You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.6 KiB
64 lines
1.6 KiB
package templates
|
|
|
|
import "track-gopher/models"
|
|
import "fmt"
|
|
|
|
templ FinalResults(results []models.FinalResult, groupName string) {
|
|
<div class="container mt-4">
|
|
<h2 class="mb-4">Final Results - { groupName }</h2>
|
|
|
|
<div class="card">
|
|
<div class="card-header bg-primary text-white">
|
|
<h3 class="mb-0">Final Standings</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>Place</th>
|
|
<th>Racer</th>
|
|
<th>Car #</th>
|
|
<th>Times</th>
|
|
<th>Final Time</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
for _, result := range results {
|
|
<tr>
|
|
<td>{ fmt.Sprintf("%d", result.Place) }</td>
|
|
<td>{ result.Racer.FirstName } { result.Racer.LastName }</td>
|
|
<td>{ result.Racer.CarNumber }</td>
|
|
<td>
|
|
<small>
|
|
for i, time := range result.Times {
|
|
if i > 0 {
|
|
,
|
|
}
|
|
if time >= 9.999 {
|
|
DNF
|
|
} else {
|
|
{ fmt.Sprintf("%.3f", time) }
|
|
}
|
|
}
|
|
</small>
|
|
</td>
|
|
<td>
|
|
if result.DNF {
|
|
<span class="text-danger">DNF</span>
|
|
} else {
|
|
<strong>{ fmt.Sprintf("%.3f", result.AverageTime) }</strong>
|
|
}
|
|
</td>
|
|
</tr>
|
|
}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="card-footer">
|
|
<small class="text-muted">Final time is the average of the fastest 3 times (discarding the slowest time if 4 runs completed)</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
} |