Reworked test view page
This commit is contained in:
parent
0fde8c082e
commit
0510c80c34
@ -24,4 +24,22 @@ class Test extends Model {
|
||||
return $this->belongsTo(Component::class);
|
||||
}
|
||||
|
||||
public function benchmarkResults() {
|
||||
$data = [];
|
||||
|
||||
foreach ($this->benchmarks as $i, $b) {
|
||||
$benchmarkResults = $this->results()->where('benchmark_id', $b->id)->get();
|
||||
$data[$i] = [
|
||||
'name' => $b->name,
|
||||
'scoring' => $b->scoring,
|
||||
'count' => count($benchmarkResults),
|
||||
'average' => 0,
|
||||
'minimum' => 0,
|
||||
'maximum' => 0,
|
||||
]
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,11 +7,6 @@
|
||||
<div class="twelve columns">
|
||||
<h1>{{ test.title }}</h1>
|
||||
<p>{{ test.description }}</p>
|
||||
<ul>
|
||||
{% for b in test.benchmarks %}
|
||||
<li>{{ b.name }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -54,26 +49,25 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="twelve columns">
|
||||
<h3>Test results:</h3>
|
||||
<h3>Benchmark results:</h3>
|
||||
|
||||
{% if test.results | length > 0 %}
|
||||
<table class="u-full-width">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Component</th>
|
||||
<th>Benchmark</th>
|
||||
<th>Scoring</th>
|
||||
<th># Results</th>
|
||||
<th>Avg.</th>
|
||||
<th>Min.</th>
|
||||
<th>Max.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in test.results %}
|
||||
{% for r in test.benchmarkResults() %}
|
||||
<tr>
|
||||
<td>{{ test.component.name }}</td>
|
||||
<td>{{ r.benchmark.name }}</td>
|
||||
<td>{{ r.benchmark.scoring | capitalize }}</td>
|
||||
<td>{{ r.name }}</td>
|
||||
<td>{{ r.scoring | capitalize }}</td>
|
||||
<td>{{ r.count }}</td>
|
||||
<td>{{ r.average }}</td>
|
||||
<td>{{ r.minimum ? r.minimum : 'N/a' }}</td>
|
||||
<td>{{ r.maximum ? r.maximum : 'N/a' }}</td>
|
||||
@ -81,9 +75,6 @@
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p>There are no results associated with this test.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user