Fixed typo in Gruntfile; added Make tasks to compile frontend assets; Modernized the gathering of benchmark result data for the test view

This commit is contained in:
2025-07-02 15:58:13 -04:00
parent 771d26ec3b
commit 190ae9f302
12 changed files with 171 additions and 26 deletions

View File

@ -3,7 +3,7 @@
<div class="row">
<h2>{{ .test.Name }}</h2>
<p><a href="/hardware/{{ .test.Hardware.ID }}">link to hardware tested.</a></p>
<p>Hardware tested: <a href="/hardware/{{ .test.Hardware.ID }}">{{ .test.Hardware.Name }}</a></p>
<p>{{ .test.Description }}</p>
@ -19,7 +19,7 @@
<h4>Add new result:</h4>
<form class="u-full-width" action="/result/add" method="POST">
<form id="result-form" class="u-full-width" action="/result/add" method="POST">
<div class="row">
<div class="columns four">
<label for="result_benchmark">
@ -35,21 +35,21 @@
<div class="columns two">
<label for="result_avg">
Average score:
<input id="result_avg" class="u-full-width" type="number" name="result_avg" value="0">
<input id="result_avg" class="u-full-width" type="number" name="result_avg" step="0.01" placeholder="0.00">
</label>
</div>
<div class="columns two">
<label for="result_min">
Minimum score:
<input id="result_min" class="u-full-width" type="number" name="result_min" value="0">
<input id="result_min" class="u-full-width" type="number" name="result_min" step="0.01" placeholder="0.00">
</label>
</div>
<div class="columns two">
<label for="result_max">
Maximum score:
<input id="result_max" class="u-full-width" type="number" name="result_max" value="0">
<input id="result_max" class="u-full-width" type="number" name="result_max" step="0.01" placeholder="0.00">
</label>
</div>
@ -58,34 +58,30 @@
</div>
<input type="hidden" name="result_test" value="{{ .test.ID }}">
<input type="hidden" name="result_hardware" value="{{ .test.Hardware.ID }}">
</div>
</form>
<hr>
<h4>Latest Benchmark Results:</h4>
<h4>Benchmark Results:</h4>
{{ $length := len .test.Results }} {{ if eq $length 0 }}
{{ $length := len .test.Benchmarks }} {{ if eq $length 0 }}
<p>There are currently no benchmarks recorded in this test.</p>
{{ else }}
<table class="u-full-width card-2">
<table id="results-table" class="u-full-width card-2" data-test-id="{{ .test.ID }}">
<thead>
<tr>
<th>Benchmark</th>
<th>Scoring Type</th>
<th># of Results</th>
<th>Average</th>
<th>Minimum</th>
<th>Maximum</th>
</tr>
</thead>
<tbody>
{{ range $res := .test.Results }}
<tr>
<td>{{ $res.Benchmark.Name }}</td>
<td>{{ $res.AverageScore }}</td>
<td>{{ if eq $res.MinimumScore 0.0 }}N/a{{ else }}{{ $res.MinimumScore }}{{ end }}</td>
<td>{{ if eq $res.MaximumScore 0.0 }}N/a{{ else }}{{ $res.MaximumScore }}{{ end }}</td>
</tr>
{{ range $benchmark := .test.Benchmarks }}
<tr data-benchmark-id="{{ $benchmark.ID }}"></tr>
{{ end }}
</tbody>
</table>
@ -96,4 +92,6 @@
<p><a href="/test">Back</a></p>
</div>
<script src="/js/test.js"></script>
{{ template "footer" . }}