Ordered result and test searches by last updated date

This commit is contained in:
Gregory Ballantine 2022-11-25 21:30:56 -05:00
parent 005b31dbd7
commit 950b12ee10
4 changed files with 6 additions and 2 deletions

View File

@ -12,7 +12,7 @@ use BitGoblin\Colossus\Models\Test;
class ResultController extends Controller {
public function getList(Request $request, Response $response): Response {
$results = Result::all();
$results = Result::orderByDesc('updated_at')->get();
$view = Twig::fromRequest($request);
return $view->render($response, 'result/list.twig', [

View File

@ -11,7 +11,7 @@ use BitGoblin\Colossus\Models\Test;
class TestController extends Controller {
public function getList(Request $request, Response $response): Response {
$tests = Test::all();
$tests = Test::orderByDesc('updated_at')->get();
$view = Twig::fromRequest($request);
return $view->render($response, 'test/list.twig', [

View File

@ -14,6 +14,7 @@
<th>Avg.</th>
<th>Min.</th>
<th>Max.</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
@ -25,6 +26,7 @@
<td>{{ r.average }}</td>
<td>{{ r.minimum ? r.minimum : 'N/a' }}</td>
<td>{{ r.maximum ? r.maximum : 'N/a' }}</td>
<td>{{ r.updated_at | date("F jS \\a\\t g:ia") }}</td>
</tr>
{% endfor %}
</tbody>

View File

@ -11,6 +11,7 @@
<tr>
<th>Test name</th>
<th>Description</th>
<th>Last updated</th>
</tr>
</thead>
<tbody>
@ -18,6 +19,7 @@
<tr>
<td><a href="{{ url_for('test.view', { test_id: t.id }) }}">{{ t.name }}</a></td>
<td>{{ t.description | slice(0, 100) }}</td>
<td>{{ t.updated_at | date("F jS \\a\\t g:ia") }}</td>
</tr>
{% endfor %}
</tbody>