null, ]; public function toggleVisibility(int $id): void { $run = BenchmarkRun::where('user_id', auth()->id())->findOrFail($id); $run->fill([ 'visibility' => $run->visibility === BenchmarkRun::VISIBILITY_PUBLIC ? BenchmarkRun::VISIBILITY_PRIVATE : BenchmarkRun::VISIBILITY_PUBLIC, ])->save(); Flux::toast(variant: 'success', text: __('Visibility updated.')); } // --- GPU confirmation ------------------------------------------------- // Runs whose raw gpu string has no catalog match carry gpu_id = null. // The owner confirms them here; confirming links gpu_id and re-runs the // summary so the run retro-merges into the correct session band. public ?int $confirmingRunId = null; public string $gpuSearch = ''; #[Computed] public function gpuChoices(): array { if ($this->gpuSearch === '') { return Gpu::active()->orderBy('vendor')->orderBy('name')->limit(10)->pluck('name', 'id')->all(); } return Gpu::active() ->where('name', 'like', "%{$this->gpuSearch}%") ->orderBy('name') ->limit(10) ->pluck('name', 'id') ->all(); } public function startGpuConfirm(int $id): void { $this->confirmingRunId = $id; $this->gpuSearch = ''; $this->modal('gpu-confirm-modal')->show(); } public function confirmGpu(int $gpuId): void { $run = BenchmarkRun::where('user_id', auth()->id())->findOrFail($this->confirmingRunId); $gpu = Gpu::active()->findOrFail($gpuId); $run->fill(['gpu' => $gpu->name, 'gpu_id' => $gpu->id])->save(); // Historical regroup: the run moves into the correct session band. Illuminate\Support\Facades\Artisan::call('festbench:summary'); Illuminate\Support\Facades\Artisan::call('festbench:snapshot'); $this->modal('gpu-confirm-modal')->close(); $this->confirmingRunId = null; Flux::toast(variant: 'success', text: __('GPU confirmed — run regrouped.')); } public function resetFilters(): void { $this->filters = ['search' => null]; $this->resetPage(); } #[Computed] public function runs(): LengthAwarePaginator { // Row + pass counts across the suite tables (runs are single-suite, // but the owning table varies per run, hence the union of counts). return BenchmarkRun::query() ->where('user_id', auth()->id()) ->select('benchmark_runs.*') ->selectRaw('(SELECT count(*) FROM softbench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id) + (SELECT count(*) FROM infrabench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id) + (SELECT count(*) FROM prosebench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id) + (SELECT count(*) FROM psychbench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id) + (SELECT count(*) FROM scenario_runs sr WHERE sr.benchmark_run_id = benchmark_runs.id) as results_count') ->selectRaw('(SELECT count(*) FROM softbench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id AND sr.ok) + (SELECT count(*) FROM infrabench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id AND sr.ok) + (SELECT count(*) FROM prosebench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id AND sr.ok) + (SELECT count(*) FROM psychbench_results sr WHERE sr.benchmark_run_id = benchmark_runs.id AND sr.ok) + (SELECT count(*) FROM scenario_runs sr WHERE sr.benchmark_run_id = benchmark_runs.id AND sr.ok) as passed_count') ->when($this->filters['search'], fn ($q, $search) => $q->where(function ($q) use ($search) { $q->where('run_id', 'like', "%{$search}%") ->orWhere('model_id', 'like', "%{$search}%") ->orWhere('label', 'like', "%{$search}%"); })) ->orderByDesc('ran_at') ->orderByDesc('id') ->paginate(25); } }; ?>