auditionadmin/app/Http/Controllers/TestController.php

45 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Actions\Tabulation\CalculateEntryScore;
use App\Exceptions\TabulationException;
use App\Models\Entry;
class TestController extends Controller
{
protected CalculateEntryScore $bigCalc;
public function __construct(CalculateEntryScore $bigCalc)
{
$this->bigCalc = $bigCalc;
}
public function flashTest()
{
$entries = Entry::forSeating()->with('student')->where('audition_id', 19)->get();
$rows = [];
foreach ($entries as $entry) {
try {
$totalScore = $this->bigCalc->calculate('seating', $entry)[0];
} catch (TabulationException $ex){
$totalScore = '--';
}
$rows[] = [
'name' => $entry->student->full_name(),
'totalScore' => $totalScore,
];
}
// try {
// $test = $this->bigCalc->calculate('seating', Entry::find(1061))[0];
// } catch (TabulationException $ex) {
// dd($ex);
// }
return view('test', compact('rows'));
}
}