diff --git a/src/Models/Test.php b/src/Models/Test.php index 493db8d..68acd3d 100644 --- a/src/Models/Test.php +++ b/src/Models/Test.php @@ -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; + } + } diff --git a/views/test/view.twig b/views/test/view.twig index 3ef914d..fa2a831 100644 --- a/views/test/view.twig +++ b/views/test/view.twig @@ -7,11 +7,6 @@
{{ test.description }}
-Benchmark | +Scoring | +# Results | +Avg. | +Min. | +Max. | +||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Component | -Benchmark | -Scoring | -Avg. | -Min. | -Max. | +{{ r.name }} | +{{ r.scoring | capitalize }} | +{{ r.count }} | +{{ r.average }} | +{{ r.minimum ? r.minimum : 'N/a' }} | +{{ r.maximum ? r.maximum : 'N/a' }} |
{{ test.component.name }} | -{{ r.benchmark.name }} | -{{ r.benchmark.scoring | capitalize }} | -{{ r.average }} | -{{ r.minimum ? r.minimum : 'N/a' }} | -{{ r.maximum ? r.maximum : 'N/a' }} | -
There are no results associated with this test.
- {% endif %} + {% endfor %} + +