Fixed the benchmark.view and component.view views so they now link to tests that reference them

This commit is contained in:
Gregory Ballantine 2025-06-26 11:51:05 -04:00
parent 6e67d58a8b
commit 1a7e41edb2
2 changed files with 22 additions and 36 deletions

View File

@ -5,8 +5,8 @@
{% block content %}
<div class="row">
<div class="twelve columns">
<h1>{{ test.name }}</h1>
<p>{{ test.description }}</p>
<h1>{{ benchmark.name }}</h1>
<p>{{ benchmark.description }}</p>
</div>
</div>
@ -14,36 +14,29 @@
<div class="row">
<div class="twelve columns">
<h3>Test results:</h3>
<p><a href="{{ url_for('result.add') }}">Add new result</a></p>
<h3>Tests using this benchmark:</h3>
{% if test.results | length > 0 %}
{% if benchmark.tests | length > 0 %}
<table class="u-full-width">
<thead>
<tr>
<th>Component</th>
<th>Benchmark</th>
<th>Scoring</th>
<th>Avg.</th>
<th>Min.</th>
<th>Max.</th>
<th>Test title</th>
<th>Benchmarks</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
{% for r in test.results %}
{% for t in benchmark.tests %}
<tr>
<td>{{ r.component }}</td>
<td>{{ r.benchmark }}</td>
<td>{{ r.type | capitalize }}</td>
<td>{{ r.average }}</td>
<td>{{ r.minimum ? r.minimum : 'N/a' }}</td>
<td>{{ r.maximum ? r.maximum : 'N/a' }}</td>
<td><a href="{{ url_for('test.view', { test_id: t.id }) }}">{{ t.title }}</a></td>
<td>{{ t.benchmarks | length }}</td>
<td>{{ t.updated_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>There are no results associated with this.</p>
<p>There are no tests associated with this benchmark.</p>
{% endif %}
</div>
</div>

View File

@ -14,36 +14,29 @@
<div class="row">
<div class="twelve columns">
<h3>Test results:</h3>
<p><a href="{{ url_for('result.add') }}">Add new result</a></p>
<h3>Tests using this component:</h3>
{% if test.results | length > 0 %}
{% if component.tests | length > 0 %}
<table class="u-full-width">
<thead>
<tr>
<th>Component</th>
<th>Benchmark</th>
<th>Scoring</th>
<th>Avg.</th>
<th>Min.</th>
<th>Max.</th>
<th>Test title</th>
<th>Benchmarks</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
{% for r in test.results %}
{% for t in component.tests %}
<tr>
<td>{{ r.component }}</td>
<td>{{ r.benchmark }}</td>
<td>{{ r.type | capitalize }}</td>
<td>{{ r.average }}</td>
<td>{{ r.minimum ? r.minimum : 'N/a' }}</td>
<td>{{ r.maximum ? r.maximum : 'N/a' }}</td>
<td><a href="{{ url_for('test.view', { test_id: t.id }) }}">{{ t.title }}</a></td>
<td>{{ t.benchmarks | length }}</td>
<td>{{ t.updated_at }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>There are no results associated with this.</p>
<p>There are no tests associated with this component.</p>
{% endif %}
</div>
</div>