diff --git a/app/Models/BenchmarkRun.php b/app/Models/BenchmarkRun.php
index 02b1ef4..13a7dfb 100644
--- a/app/Models/BenchmarkRun.php
+++ b/app/Models/BenchmarkRun.php
@@ -116,7 +116,7 @@ public function depthsweepResults(): HasMany
* an empty collection for suites this run does not have. An optional
* level filter narrows to one thinking level (depthsweep drill-in).
*/
- public function suiteResults(?string $level = null): Collection
+ public function suiteResults(?string $level = null, ?string $sortBy = null, ?string $sortDir = null): Collection
{
$model = Suites::modelFor($this->suite);
@@ -126,11 +126,13 @@ public function suiteResults(?string $level = null): Collection
$relation = Suites::runRelation($this->suite);
- $orderCol = $this->suite === 'scenariobench' ? 'scenario' : 'task';
+ $defaultOrder = $this->suite === 'scenariobench' ? 'scenario' : 'task';
+ $orderCol = $sortBy ?? $defaultOrder;
+ $direction = $sortDir === 'asc' ? 'asc' : 'desc';
return $this->{$relation}()
->when($level !== null && $level !== '', fn ($q) => $q->where('level', $level))
- ->orderBy($orderCol)
+ ->orderBy($orderCol, $direction)
->orderBy('id')
->get();
}
diff --git a/resources/views/livewire/runs/show.blade.php b/resources/views/livewire/runs/show.blade.php
index 187d7d2..297a2de 100644
--- a/resources/views/livewire/runs/show.blade.php
+++ b/resources/views/livewire/runs/show.blade.php
@@ -1,5 +1,6 @@
sortBy, $allowed, true) ? $this->sortBy : $allowed[0];
+ }
+
+ private function sortDir(): string
+ {
+ return $this->sortDirection === 'asc' ? 'asc' : 'desc';
+ }
};
?>
@@ -137,24 +166,25 @@ private function authorizeOwner(): void
{{ $this->run->suite === 'scenariobench' ? __('Scenario results') : ($this->run->suite === 'depthsweep' ? __('Depth sweep results') : __('Task results')) }}
@if ($this->run->suite === 'scenariobench')
+ @php($sortCol = $this->sortColumn(self::SORTABLE_SCENARIO))
- {{ __('Scenario') }}
- {{ __('Level') }}
- {{ __('Pass') }}
- {{ __('Outcome') }}
- {{ __('Wall (s)') }}
- {{ __('Turns') }}
- {{ __('Commands') }}
- {{ __('Submissions') }}
- {{ __('Rejected') }}
- {{ __('t first sub') }}
- {{ __('t pass') }}
- {{ __('Gen tokens') }}
+ {{ __('Scenario') }}
+ {{ __('Level') }}
+ {{ __('Pass') }}
+ {{ __('Outcome') }}
+ {{ __('Wall (s)') }}
+ {{ __('Turns') }}
+ {{ __('Commands') }}
+ {{ __('Submissions') }}
+ {{ __('Rejected') }}
+ {{ __('t first sub') }}
+ {{ __('t pass') }}
+ {{ __('Gen tokens') }}
- @foreach ($this->run->suiteResults() as $result)
+ @foreach ($this->run->suiteResults($this->level, $sortCol, $this->sortDir()) as $result)
{{ $result->scenario }}
{{ $result->level ?? '—' }}
@@ -188,20 +218,21 @@ private function authorizeOwner(): void
{{ __('show all levels') }}
@endif
+ @php($sortCol = $this->sortColumn(self::SORTABLE_DEPTHSWEEP))
- {{ __('Depth') }}
- {{ __('Task') }}
- {{ __('Level') }}
- {{ __('Found') }}
+ {{ __('Depth') }}
+ {{ __('Task') }}
+ {{ __('Level') }}
+ {{ __('Found') }}
{{ __('Needle') }}
- {{ __('TTFT') }}
- {{ __('Wall') }}
- {{ __('Visible') }}
+ {{ __('TTFT') }}
+ {{ __('Wall') }}
+ {{ __('Visible') }}
- @foreach ($this->run->suiteResults($this->level) as $result)
+ @foreach ($this->run->suiteResults($this->level, $sortCol, $this->sortDir()) as $result)
{{ $result->section }}
{{ $result->task }}
@@ -222,32 +253,33 @@ private function authorizeOwner(): void
@else
+ @php($sortCol = $this->sortColumn(self::SORTABLE_METRIC))
@if (in_array($this->run->suite, ['softbench', 'prosebench', 'psychbench']))
- {{ __('Section') }}
+ {{ __('Section') }}
@endif
- {{ __('Task') }}
- {{ __('Level') }}
- {{ __('Pass') }}
+ {{ __('Task') }}
+ {{ __('Level') }}
+ {{ __('Pass') }}
@if (in_array($this->run->suite, ['prosebench', 'psychbench']))
- {{ __('Checks') }}
+ {{ __('Checks') }}
@endif
@if ($this->run->suite === 'infrabench')
- {{ __('Kind') }}
+ {{ __('Kind') }}
@endif
- {{ __('User tok/s') }}
- {{ __('Decode') }}
- {{ __('TTFT') }}
- {{ __('t_answer') }}
- {{ __('Wall') }}
- {{ __('Reasoning') }}
- {{ __('Visible') }}
- {{ __('Finish') }}
+ {{ __('User tok/s') }}
+ {{ __('Decode') }}
+ {{ __('TTFT') }}
+ {{ __('t_answer') }}
+ {{ __('Wall') }}
+ {{ __('Reasoning') }}
+ {{ __('Visible') }}
+ {{ __('Finish') }}
- @foreach ($this->run->suiteResults() as $result)
+ @foreach ($this->run->suiteResults(null, $sortCol, $this->sortDir()) as $result)
@if (in_array($this->run->suite, ['softbench', 'prosebench', 'psychbench']))
{{ $result->section ?? '—' }}
diff --git a/resources/views/livewire/sessions/scenarios.blade.php b/resources/views/livewire/sessions/scenarios.blade.php
index a599168..51ffa6e 100644
--- a/resources/views/livewire/sessions/scenarios.blade.php
+++ b/resources/views/livewire/sessions/scenarios.blade.php
@@ -1,5 +1,6 @@
runs->pluck('id');
+ $column = in_array($this->sortBy, self::SORTABLE, true) ? $this->sortBy : 'scenario';
+ $direction = $this->sortDirection === 'asc' ? 'asc' : 'desc';
+
return DB::table('scenario_runs')
->whereIn('benchmark_run_id', $runIds)
- ->orderBy('scenario')
- ->orderBy('benchmark_run_id')
+ ->orderBy($column, $direction)
+ ->orderBy('id')
->get();
}
};
@@ -96,18 +108,18 @@ public function results()
- {{ __('Scenario') }}
- {{ __('Level') }}
- {{ __('Pass') }}
- {{ __('Outcome') }}
- {{ __('Wall (s)') }}
- {{ __('Turns') }}
- {{ __('Commands') }}
- {{ __('Submissions') }}
- {{ __('Rejected') }}
- {{ __('t first sub') }}
- {{ __('t pass') }}
- {{ __('Gen tokens') }}
+ {{ __('Scenario') }}
+ {{ __('Level') }}
+ {{ __('Pass') }}
+ {{ __('Outcome') }}
+ {{ __('Wall (s)') }}
+ {{ __('Turns') }}
+ {{ __('Commands') }}
+ {{ __('Submissions') }}
+ {{ __('Rejected') }}
+ {{ __('t first sub') }}
+ {{ __('t pass') }}
+ {{ __('Gen tokens') }}