calc = $calc; $this->ranker = $ranker; $this->doublerService = $doublerService; $this->entryService = $entryService; $this->auditionService = $auditionService; } public function __invoke(Request $request, Audition $audition) { $doublers = $this->doublerService->doublersForEvent($audition->event); $entryData = []; $entries = $this->ranker->rank('seating', $audition); $entries->load('student.school'); foreach ($entries as $entry) { $totalScoreColumn = 'No Score'; $fullyScored = false; if ($entry->score_totals) { $totalScoreColumn = $entry->score_totals[0] >= 0 ? $entry->score_totals[0] : $entry->score_message; $fullyScored = $entry->score_totals[0] >= 0; } $entryData[] = [ 'rank' => $entry->rank, 'id' => $entry->id, 'studentName' => $entry->student->full_name(), 'schoolName' => $entry->student->school->name, 'drawNumber' => $entry->draw_number, 'totalScore' => $totalScoreColumn, 'fullyScored' => $fullyScored, 'doubleData' => $this->doublerService->entryDoublerData($entry), ]; } return view('tabulation.auditionSeating', compact('entryData', 'audition', 'doublers')); } }