Remove director results for optimization

This commit is contained in:
Matt Young 2024-11-09 11:11:01 -06:00
parent ada3865f6a
commit fe72d148e9
2 changed files with 37 additions and 36 deletions

View File

@ -31,27 +31,28 @@ class DashboardController extends Controller
GetEntrySeatingResult $resultGenerator, GetEntrySeatingResult $resultGenerator,
RankAuditionEntries $ranker RankAuditionEntries $ranker
) { ) {
$entries = Auth::user()->entries; // $entries = Auth::user()->entries;
$entries = $entries->filter(function ($entry) { // $entries = $entries->filter(function ($entry) {
return $entry->audition->hasFlag('seats_published'); // return $entry->audition->hasFlag('seats_published');
}); // });
$entries = $entries->sortBy(function ($entry) { // $entries = $entries->sortBy(function ($entry) {
return $entry->student->full_name(true); // return $entry->student->full_name(true);
}); // });
$scores = []; // $scores = [];
$results = []; // $results = [];
$ranks = []; // $ranks = [];
foreach ($entries as $entry) { // foreach ($entries as $entry) {
$results[$entry->id] = $resultGenerator->getResult($entry); // $results[$entry->id] = $resultGenerator->getResult($entry);
if (! $entry->hasFlag('no_show') && ! $entry->hasFlag('failed_prelim')) { // if (! $entry->hasFlag('no_show') && ! $entry->hasFlag('failed_prelim')) {
$scores[$entry->id] = $scoreCalc->calculate('seating', $entry); // $scores[$entry->id] = $scoreCalc->calculate('seating', $entry);
$auditionResults = $ranker->rank('seating', $entry->audition); // $auditionResults = $ranker->rank('seating', $entry->audition);
$ranks[$entry->id] = $auditionResults->firstWhere('id', $entry->id)->raw_rank; // $ranks[$entry->id] = $auditionResults->firstWhere('id', $entry->id)->raw_rank;
} // }
} // }
$showRecapLink = AuditionFlag::where('flag_name', 'seats_published')->count() > 0; // $showRecapLink = AuditionFlag::where('flag_name', 'seats_published')->count() > 0;
//
return view('dashboard.dashboard', compact('entries', 'scores', 'results', 'ranks', 'showRecapLink')); // return view('dashboard.dashboard', compact('entries', 'scores', 'results', 'ranks', 'showRecapLink'));
return view('dashboard.dashboard');
} }
public function my_school() public function my_school()

View File

@ -27,24 +27,24 @@
</x-card.list.row> </x-card.list.row>
</a> </a>
@endif @endif
@if($showRecapLink) {{-- @if($showRecapLink)--}}
<a href="{{ route('recap.selectAudition') }}"> {{-- <a href="{{ route('recap.selectAudition') }}">--}}
<x-card.list.row class="hover:bg-gray-200"> {{-- <x-card.list.row class="hover:bg-gray-200">--}}
Audition Score Recaps {{-- Audition Score Recaps--}}
</x-card.list.row> {{-- </x-card.list.row>--}}
</a> {{-- </a>--}}
@endif {{-- @endif--}}
</x-card.list.body> </x-card.list.body>
</x-card.card> </x-card.card>
</div> </div>
@if(Auth::user()->school_id) {{-- @if(Auth::user()->school_id)--}}
<div class="md:col-span-3 pl-3">{{-- Column 2 Results --}} {{-- <div class="md:col-span-3 pl-3">--}}{{-- Column 2 Results --}}
<x-card.card> {{-- <x-card.card>--}}
<x-card.heading>My Results</x-card.heading> {{-- <x-card.heading>My Results</x-card.heading>--}}
@include('dashboard.results-table') {{-- @include('dashboard.results-table')--}}
</x-card.card> {{-- </x-card.card>--}}
</div> {{-- </div>--}}
@endif {{-- @endif--}}
<div> <div>