Rewrite tabulation #14
|
|
@ -58,8 +58,8 @@ class AllJudgesCount implements CalculateEntryScore
|
|||
|
||||
protected function areAllJudgesValid(Entry $entry): void
|
||||
{
|
||||
$validJudgeIds = $entry->audition->judges->pluck('id')->sort()->toArray();
|
||||
$existingJudgeIds = $entry->scoreSheets->pluck('user_id')->sort()->toArray();
|
||||
$validJudgeIds = $entry->audition->judges->sort()->pluck('id')->toArray();
|
||||
$existingJudgeIds = $entry->scoreSheets->sort()->pluck('user_id')->toArray();
|
||||
if ($validJudgeIds !== $existingJudgeIds) {
|
||||
throw new TabulationException('Score exists from a judge not assigned to this audition');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,26 +2,43 @@
|
|||
|
||||
namespace App\Http\Controllers\Tabulation;
|
||||
|
||||
use App\Actions\Tabulation\CalculateEntryScore;
|
||||
use App\Exceptions\TabulationException;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Models\Audition;
|
||||
use App\Models\Entry;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class SeatAuditionController extends Controller
|
||||
{
|
||||
/**
|
||||
* Handle the incoming request.
|
||||
*/
|
||||
public function __invoke(Request $request)
|
||||
protected CalculateEntryScore $calc;
|
||||
|
||||
public function __construct(CalculateEntryScore $calc)
|
||||
{
|
||||
$this->calc = $calc;
|
||||
}
|
||||
|
||||
public function __invoke(Request $request, Audition $audition)
|
||||
{
|
||||
$entryData = [];
|
||||
$entries = Entry::forSeating()->with('student.school')->get();
|
||||
$entries = Entry::forSeating()->with('student.school')->where('audition_id', $audition->id)->get();
|
||||
foreach ($entries as $entry) {
|
||||
try {
|
||||
$totalScore = $this->calc->calculate('seating', $entry);
|
||||
} catch (TabulationException $ex) {
|
||||
$totalScore[0] = $ex->getMessage();
|
||||
}
|
||||
$entryData[] = [
|
||||
'rank' => 'xx',
|
||||
'rank' => 'not implemented',
|
||||
'id' => $entry->id,
|
||||
'studentName' => $entry->student->full_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;
|
||||
|
||||
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
|
||||
{
|
||||
|
|
@ -16,7 +18,7 @@ class TestController extends Controller
|
|||
|
||||
public function flashTest()
|
||||
{
|
||||
$entries = Entry::forSeating()->with('student')->where('audition_id', 19)->get();
|
||||
$entries = Entry::forSeating()->with('student')->where('audition_id', 17)->get();
|
||||
$rows = [];
|
||||
foreach ($entries as $entry) {
|
||||
try {
|
||||
|
|
@ -29,7 +31,8 @@ class TestController extends Controller
|
|||
'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) {
|
||||
|
|
@ -39,6 +42,6 @@ class TestController extends Controller
|
|||
|
||||
|
||||
|
||||
return view('test', compact('rows'));
|
||||
return view('test', compact('rows', 'bam'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,23 +16,23 @@
|
|||
</thead>
|
||||
|
||||
<x-table.body>
|
||||
@foreach($entries as $entry)
|
||||
@foreach($entryData as $entry)
|
||||
<tr>
|
||||
<x-table.td>{{ $entry->rank }}</x-table.td>
|
||||
<x-table.td>{{ $entry->id }}</x-table.td>
|
||||
<x-table.td>{{ $entry->draw_number }}</x-table.td>
|
||||
<x-table.td>{{ $entry['rank'] }}</x-table.td>
|
||||
<x-table.td>{{ $entry['id'] }}</x-table.td>
|
||||
<x-table.td>{{ $entry['drawNumber'] }}</x-table.td>
|
||||
<x-table.td class="flex flex-col">
|
||||
<span>{{ $entry->student->full_name() }}</span>
|
||||
<span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span>
|
||||
<span>{{ $entry['studentName'] }}</span>
|
||||
<span class="text-xs text-gray-400">{{ $entry['schoolName'] }}</span>
|
||||
</x-table.td>
|
||||
<x-table.td class="!py-0">
|
||||
@if($doublerService->studentIsDoubler($entry->student_id))
|
||||
@include('tabulation.auditionSeating-doubler-block')
|
||||
@endif
|
||||
{{-- @if($doublerService->studentIsDoubler($entry->student_id))--}}
|
||||
{{-- @include('tabulation.auditionSeating-doubler-block')--}}
|
||||
{{-- @endif--}}
|
||||
</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>
|
||||
@if($entry->scoring_complete)
|
||||
@if(is_numeric($entry['totalScore']))
|
||||
<x-icons.checkmark color="green"/>
|
||||
@endif
|
||||
</x-table.td>
|
||||
|
|
|
|||
|
|
@ -9,21 +9,19 @@
|
|||
<div class="col-span-3">
|
||||
@include('tabulation.auditionSeating-results-table')
|
||||
</div>
|
||||
<div class="ml-4">
|
||||
@if($audition->hasFlag('seats_published'))
|
||||
@include('tabulation.auditionSeating-show-published-seats')
|
||||
@elseif(! $auditionComplete)
|
||||
@include('tabulation.auditionSeating-unable-to-seat-card')
|
||||
@else
|
||||
@include('tabulation.auditionSeating-fill-seats-form')
|
||||
@include('tabulation.auditionSeating-show-proposed-seats')
|
||||
@endif
|
||||
{{-- <div class="ml-4">--}}
|
||||
{{-- @if($audition->hasFlag('seats_published'))--}}
|
||||
{{-- @include('tabulation.auditionSeating-show-published-seats')--}}
|
||||
{{-- @elseif(! $auditionComplete)--}}
|
||||
{{-- @include('tabulation.auditionSeating-unable-to-seat-card')--}}
|
||||
{{-- @else--}}
|
||||
{{-- @include('tabulation.auditionSeating-fill-seats-form')--}}
|
||||
{{-- @include('tabulation.auditionSeating-show-proposed-seats')--}}
|
||||
{{-- @endif--}}
|
||||
|
||||
|
||||
</div>
|
||||
{{-- </div>--}}
|
||||
</div>
|
||||
|
||||
|
||||
</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('drawService', 'App\Services\DrawService')
|
||||
<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)
|
||||
{{ $row['name'] }} - {{ $row['totalScore'] }}<hr>
|
||||
@endforeach
|
||||
|
|
|
|||
Loading…
Reference in New Issue