55 lines
1.6 KiB
PHP
55 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Tabulation;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Audition;
|
|
use App\Services\DoublerService;
|
|
use App\Services\TabulationService;
|
|
|
|
use function compact;
|
|
|
|
class TabulationController extends Controller
|
|
{
|
|
protected $tabulationService;
|
|
|
|
protected $doublerService;
|
|
|
|
public function __construct(TabulationService $tabulationService, DoublerService $doublerService)
|
|
{
|
|
$this->tabulationService = $tabulationService;
|
|
$this->doublerService = $doublerService;
|
|
}
|
|
|
|
public function status()
|
|
{
|
|
$auditions = $this->tabulationService->getAuditionsWithStatus();
|
|
|
|
return view('tabulation.status', compact('auditions'));
|
|
}
|
|
|
|
public function auditionSeating(Audition $audition)
|
|
{
|
|
$entries = $this->tabulationService->auditionEntries($audition->id);
|
|
$complete = true;
|
|
$doublerComplete = true;
|
|
foreach ($entries as $entry) {
|
|
if (! $entry->scoring_complete) {
|
|
$complete = false;
|
|
}
|
|
|
|
if ($this->doublerService->studentIsDoubler($entry->student_id)) { // If this entry is a doubler
|
|
if ($this->doublerService->getDoublerInfo($entry->student_id)[$entry->id]['status']) { // If there is no decision for this entry
|
|
$doublerComplete = false;
|
|
}
|
|
}
|
|
}
|
|
|
|
$complete = $entries->every(function ($entry) {
|
|
return $entry->scoring_complete;
|
|
});
|
|
|
|
return view('tabulation.auditionSeating', compact('audition', 'entries', 'complete', 'doublerComplete'));
|
|
}
|
|
}
|