null, 'model' => null, 'suite' => null, ]; public function resetFilters(): void { $this->filters = ['search' => null, 'model' => null, 'suite' => null]; $this->resetPage(); } #[Computed] public function sessions() { $ttl = (int) config('festbench.home_cache_ttl', 300); $user = auth()->user(); // Guest views are shared-cacheable; logged-in views may contain the // user's private bands, so they get a user-scoped key. $cacheKey = 'summary:'.($user?->id ?? 'guest').':'.md5(json_encode([$this->filters, $this->getPage()])); return Cache::remember($cacheKey, $ttl, function () use ($user) { $bands = $this->bandQuery($user)->paginate(10); $runIds = $bands->getCollection()->map(fn ($b) => $b->id)->all(); $suiteRows = $runIds === [] ? collect() : \Illuminate\Support\Facades\DB::table('session_suite_rows') ->whereIn('session_summary_id', $runIds) ->orderBy('sequence') ->get() ->groupBy('session_summary_id'); $bands->getCollection()->transform(fn ($band) => (object) [ 'band' => $band, 'suites' => $suiteRows->get($band->id, collect()), ]); return $bands; }); } private function bandQuery($user) { return \Illuminate\Support\Facades\DB::table('session_summaries') ->where(function ($q) use ($user) { $q->where('visibility', 'public'); if ($user !== null) { $q->orWhere(function ($own) use ($user) { $own->where('visibility', 'private')->where('user_id', $user->id); }); } }) ->when($this->filters['search'], fn ($q, $search) => $q->where(function ($q) use ($search) { $q->where('label', 'like', "%{$search}%") ->orWhere('model_id', 'like', "%{$search}%") ->orWhere('gpu', 'like', "%{$search}%") ->orWhere('runner_name', 'like', "%{$search}%"); })) ->when($this->filters['model'], fn ($q, $model) => $q->where('model_id', $model)) // Suite filter: keep bands containing the chosen suite ->when($this->filters['suite'], fn ($q, $suite) => $q->whereExists(function ($sub) use ($suite) { $sub->select(\Illuminate\Support\Facades\DB::raw(1)) ->from('session_suite_rows') ->whereColumn('session_suite_rows.session_summary_id', 'session_summaries.id') ->where('session_suite_rows.suite', $suite); })) ->orderByDesc('ran_at') ->orderBy('sequence'); } #[Computed] public function models(): array { return Cache::remember('summary:models', 300, function () { return \Illuminate\Support\Facades\DB::table('session_summaries') ->where('visibility', 'public') ->distinct()->orderBy('model_id')->pluck('model_id')->all(); }); } #[Computed] public function suites(): array { return Cache::remember('summary:suites', 300, function () { return \Illuminate\Support\Facades\DB::table('session_suite_rows') ->join('session_summaries', 'session_summaries.id', '=', 'session_suite_rows.session_summary_id') ->where('session_summaries.visibility', 'public') ->distinct()->orderBy('suite')->pluck('suite')->all(); }); } }; ?>
{{ __('Benchmark Sessions') }} {{ __('GPU, model, suite scores — click a suite line for per-task detail.') }}
{{ __('All task rows') }}
@foreach ($this->models as $model) {{ $model }} @endforeach @foreach ($this->suites as $suite) {{ $suite }} @endforeach {{ __('Clear') }}
@if ($this->sessions->count() > 0)
@foreach ($this->sessions as $session)
{{ $session->band->gpu ?? 'unknown GPU' }} @if ($session->band->gpu_count) ×{{ $session->band->gpu_count }} @endif {{ $session->band->model_id ?? 'unknown model' }} @if ($session->band->model_quant) {{ $session->band->model_quant }} @endif {{ $session->band->runner_name ?? 'anonymous' }} {{ optional($session->band->ran_at)->format('M j Y') }}
@if ($session->band->label)
{{ $session->band->label }}
@endif {{-- Column titles aligned over the suite rows (md+ only) --}}
@endforeach
{{ $this->sessions->links() }}
@else
{{ __('No sessions') }} {{ __('No benchmark sessions match the current filters.') }}
@endif