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

View File

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