blt/templates/test/view.tmpl

100 lines
2.7 KiB
Cheetah
Raw Normal View History

2023-12-02 22:16:16 -05:00
{{ template "header" . }}
<div class="row">
2024-05-29 08:45:53 -04:00
<h2>{{ .test.Name }}</h2>
2023-12-02 22:16:16 -05:00
<p><a href="/hardware/{{ .test.Hardware.ID }}">link to hardware tested.</a></p>
2023-12-02 22:16:16 -05:00
<p>{{ .test.Description }}</p>
<h4>Benchmarks used:</h4>
<ul>
{{ range $bm := .test.Benchmarks }}
<li><a href="/benchmark/{{ $bm.ID }}">{{ $bm.Name }}</a></li>
{{ end }}
</ul>
2023-12-02 22:16:16 -05:00
<hr>
<h4>Add new result:</h4>
<form class="u-full-width" action="/result/add" method="POST">
<div class="row">
<div class="columns four">
2024-05-29 11:40:42 -04:00
<label for="result_benchmark">
Benchmark:
<select id="result_benchmark" class="u-full-width" name="result_benchmark">
{{ range $bm := .test.Benchmarks }}
<option value="{{ $bm.ID }}">{{ $bm.Name }}</option>
{{ end }}
</select>
</label>
</div>
<div class="columns two">
2024-05-29 11:40:42 -04:00
<label for="result_avg">
Average score:
<input id="result_avg" class="u-full-width" type="number" name="result_avg" value="0">
</label>
</div>
<div class="columns two">
2024-05-29 11:40:42 -04:00
<label for="result_min">
Minimum score:
<input id="result_min" class="u-full-width" type="number" name="result_min" value="0">
</label>
</div>
<div class="columns two">
2024-05-29 11:40:42 -04:00
<label for="result_max">
Maximum score:
<input id="result_max" class="u-full-width" type="number" name="result_max" value="0">
</label>
</div>
<div class="columns two">
<button class="button-primary u-full-width" type="submit" name="button">Submit</button>
</div>
<input type="hidden" name="result_test" value="{{ .test.ID }}">
<input type="hidden" name="result_hardware" value="{{ .test.Hardware.ID }}">
</div>
</form>
<hr>
2024-05-29 08:42:53 -04:00
<h4>Latest Benchmark Results:</h4>
{{ $length := len .test.Results }} {{ if eq $length 0 }}
<p>There are currently no benchmarks recorded in this test.</p>
{{ else }}
<table class="u-full-width">
<thead>
<tr>
<th>Benchmark</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>
2024-05-29 12:04:08 -04:00
<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>
{{ end }}
</tbody>
</table>
{{ end }}
2024-05-29 08:42:53 -04:00
<hr>
2023-12-02 22:16:16 -05:00
<p><a href="/test">Back</a></p>
</div>
{{ template "footer" . }}