auditionadmin/app/Http/Controllers/TestController.php

48 lines
1.3 KiB
PHP

<?php
namespace App\Http\Controllers;
use App\Actions\Tabulation\CalculateEntryScore;
use App\Actions\Tabulation\CalculateScoreSheetTotal;
use App\Exceptions\TabulationException;
use App\Models\Entry;
use App\Models\User;
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', 17)->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,
];
}
$scoreCalc = new CalculateScoreSheetTotal;
$bam = $scoreCalc('seating', Entry::find(916), User::find(65))[0];
// try {
// $test = $this->bigCalc->calculate('seating', Entry::find(1061))[0];
// } catch (TabulationException $ex) {
// dd($ex);
// }
return view('test', compact('rows', 'bam'));
}
}