Seating page implemented other than doublers
This commit is contained in:
parent
98b466beb6
commit
a59a4c1d2b
|
|
@ -58,8 +58,8 @@ class AllJudgesCount implements CalculateEntryScore
|
||||||
|
|
||||||
protected function areAllJudgesValid(Entry $entry): void
|
protected function areAllJudgesValid(Entry $entry): void
|
||||||
{
|
{
|
||||||
$validJudgeIds = $entry->audition->judges->pluck('id')->sort()->toArray();
|
$validJudgeIds = $entry->audition->judges->sort()->pluck('id')->toArray();
|
||||||
$existingJudgeIds = $entry->scoreSheets->pluck('user_id')->sort()->toArray();
|
$existingJudgeIds = $entry->scoreSheets->sort()->pluck('user_id')->toArray();
|
||||||
if ($validJudgeIds !== $existingJudgeIds) {
|
if ($validJudgeIds !== $existingJudgeIds) {
|
||||||
throw new TabulationException('Score exists from a judge not assigned to this audition');
|
throw new TabulationException('Score exists from a judge not assigned to this audition');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,26 +2,43 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers\Tabulation;
|
namespace App\Http\Controllers\Tabulation;
|
||||||
|
|
||||||
|
use App\Actions\Tabulation\CalculateEntryScore;
|
||||||
|
use App\Exceptions\TabulationException;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Audition;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class SeatAuditionController extends Controller
|
class SeatAuditionController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
protected CalculateEntryScore $calc;
|
||||||
* Handle the incoming request.
|
|
||||||
*/
|
public function __construct(CalculateEntryScore $calc)
|
||||||
public function __invoke(Request $request)
|
{
|
||||||
|
$this->calc = $calc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __invoke(Request $request, Audition $audition)
|
||||||
{
|
{
|
||||||
$entryData = [];
|
$entryData = [];
|
||||||
$entries = Entry::forSeating()->with('student.school')->get();
|
$entries = Entry::forSeating()->with('student.school')->where('audition_id', $audition->id)->get();
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
|
try {
|
||||||
|
$totalScore = $this->calc->calculate('seating', $entry);
|
||||||
|
} catch (TabulationException $ex) {
|
||||||
|
$totalScore[0] = $ex->getMessage();
|
||||||
|
}
|
||||||
$entryData[] = [
|
$entryData[] = [
|
||||||
'rank' => 'xx',
|
'rank' => 'not implemented',
|
||||||
'id' => $entry->id,
|
'id' => $entry->id,
|
||||||
'studentName' => $entry->student->full_name(),
|
'studentName' => $entry->student->full_name(),
|
||||||
'schoolName' => $entry->student->school->name,
|
'schoolName' => $entry->student->school->name,
|
||||||
|
'drawNumber' => $entry->draw_number,
|
||||||
|
'totalScore' => $totalScore[0],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//dd($entryData);
|
||||||
|
return view('tabulation.auditionSeating', ['entryData' => $entryData, 'audition' => $audition]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,10 @@
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Actions\Tabulation\CalculateEntryScore;
|
use App\Actions\Tabulation\CalculateEntryScore;
|
||||||
|
use App\Actions\Tabulation\CalculateScoreSheetTotal;
|
||||||
use App\Exceptions\TabulationException;
|
use App\Exceptions\TabulationException;
|
||||||
use App\Models\Entry;
|
use App\Models\Entry;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
class TestController extends Controller
|
class TestController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -16,7 +18,7 @@ class TestController extends Controller
|
||||||
|
|
||||||
public function flashTest()
|
public function flashTest()
|
||||||
{
|
{
|
||||||
$entries = Entry::forSeating()->with('student')->where('audition_id', 19)->get();
|
$entries = Entry::forSeating()->with('student')->where('audition_id', 17)->get();
|
||||||
$rows = [];
|
$rows = [];
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -29,7 +31,8 @@ class TestController extends Controller
|
||||||
'totalScore' => $totalScore,
|
'totalScore' => $totalScore,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
$scoreCalc = new CalculateScoreSheetTotal;
|
||||||
|
$bam = $scoreCalc('seating', Entry::find(916), User::find(65))[0];
|
||||||
// try {
|
// try {
|
||||||
// $test = $this->bigCalc->calculate('seating', Entry::find(1061))[0];
|
// $test = $this->bigCalc->calculate('seating', Entry::find(1061))[0];
|
||||||
// } catch (TabulationException $ex) {
|
// } catch (TabulationException $ex) {
|
||||||
|
|
@ -39,6 +42,6 @@ class TestController extends Controller
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return view('test', compact('rows'));
|
return view('test', compact('rows', 'bam'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,23 +16,23 @@
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<x-table.body>
|
<x-table.body>
|
||||||
@foreach($entries as $entry)
|
@foreach($entryData as $entry)
|
||||||
<tr>
|
<tr>
|
||||||
<x-table.td>{{ $entry->rank }}</x-table.td>
|
<x-table.td>{{ $entry['rank'] }}</x-table.td>
|
||||||
<x-table.td>{{ $entry->id }}</x-table.td>
|
<x-table.td>{{ $entry['id'] }}</x-table.td>
|
||||||
<x-table.td>{{ $entry->draw_number }}</x-table.td>
|
<x-table.td>{{ $entry['drawNumber'] }}</x-table.td>
|
||||||
<x-table.td class="flex flex-col">
|
<x-table.td class="flex flex-col">
|
||||||
<span>{{ $entry->student->full_name() }}</span>
|
<span>{{ $entry['studentName'] }}</span>
|
||||||
<span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span>
|
<span class="text-xs text-gray-400">{{ $entry['schoolName'] }}</span>
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
<x-table.td class="!py-0">
|
<x-table.td class="!py-0">
|
||||||
@if($doublerService->studentIsDoubler($entry->student_id))
|
{{-- @if($doublerService->studentIsDoubler($entry->student_id))--}}
|
||||||
@include('tabulation.auditionSeating-doubler-block')
|
{{-- @include('tabulation.auditionSeating-doubler-block')--}}
|
||||||
@endif
|
{{-- @endif--}}
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
<x-table.td>{{ number_format($entry->final_score_array[0] ?? 0,4) }}</x-table.td>
|
<x-table.td>{{ $entry['totalScore'] }}</x-table.td>
|
||||||
<x-table.td>
|
<x-table.td>
|
||||||
@if($entry->scoring_complete)
|
@if(is_numeric($entry['totalScore']))
|
||||||
<x-icons.checkmark color="green"/>
|
<x-icons.checkmark color="green"/>
|
||||||
@endif
|
@endif
|
||||||
</x-table.td>
|
</x-table.td>
|
||||||
|
|
|
||||||
|
|
@ -9,21 +9,19 @@
|
||||||
<div class="col-span-3">
|
<div class="col-span-3">
|
||||||
@include('tabulation.auditionSeating-results-table')
|
@include('tabulation.auditionSeating-results-table')
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-4">
|
{{-- <div class="ml-4">--}}
|
||||||
@if($audition->hasFlag('seats_published'))
|
{{-- @if($audition->hasFlag('seats_published'))--}}
|
||||||
@include('tabulation.auditionSeating-show-published-seats')
|
{{-- @include('tabulation.auditionSeating-show-published-seats')--}}
|
||||||
@elseif(! $auditionComplete)
|
{{-- @elseif(! $auditionComplete)--}}
|
||||||
@include('tabulation.auditionSeating-unable-to-seat-card')
|
{{-- @include('tabulation.auditionSeating-unable-to-seat-card')--}}
|
||||||
@else
|
{{-- @else--}}
|
||||||
@include('tabulation.auditionSeating-fill-seats-form')
|
{{-- @include('tabulation.auditionSeating-fill-seats-form')--}}
|
||||||
@include('tabulation.auditionSeating-show-proposed-seats')
|
{{-- @include('tabulation.auditionSeating-show-proposed-seats')--}}
|
||||||
@endif
|
{{-- @endif--}}
|
||||||
|
|
||||||
|
|
||||||
</div>
|
{{-- </div>--}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</x-layout.app>
|
</x-layout.app>
|
||||||
|
|
||||||
{{--TODO deal with unlikely scenario of a doubler is entered for seating on some auditions but not others--}}
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
@inject('seatingService','App\Services\SeatingService')
|
@inject('seatingService','App\Services\SeatingService')
|
||||||
@inject('drawService', 'App\Services\DrawService')
|
@inject('drawService', 'App\Services\DrawService')
|
||||||
<x-layout.app>
|
<x-layout.app>
|
||||||
<x-slot:page_title>Test Page</x-slot:page_title>
|
<x-slot:page_title>Test Page - {{ $bam ?? '' }}</x-slot:page_title>
|
||||||
@foreach($rows as $row)
|
@foreach($rows as $row)
|
||||||
{{ $row['name'] }} - {{ $row['totalScore'] }}<hr>
|
{{ $row['name'] }} - {{ $row['totalScore'] }}<hr>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue