Advancement tabulation #3

Merged
okorpheus merged 4 commits from advancement-tabulation into master 2024-06-26 22:20:11 +00:00
5 changed files with 67 additions and 22 deletions
Showing only changes of commit f5db2eae78 - Show all commits

View File

@ -25,11 +25,12 @@ class AdvancementController extends Controller
public function ranking(Request $request, Audition $audition)
{
$entries = $this->tabulationService->auditionEntries($audition->id);
$entries = $entries->filter(function ($entry) {
return $entry->for_advancement;
$entries = $this->tabulationService->auditionEntries($audition->id, 'advancement');
$scoringComplete = $entries->every(function ($entry) {
return $entry->scoring_complete;
});
return view('tabulation.advancement.ranking', compact('audition', 'entries'));
return view('tabulation.advancement.ranking', compact('audition', 'entries','scoringComplete'));
}
}

View File

@ -54,7 +54,7 @@ class TabulationService
$audition = $this->auditionCacheService->getAudition($auditionId);
$entries = $this->entryCacheService->getEntriesForAudition($auditionId, $mode);
$this->scoreService->calculateScoresForAudition($auditionId);
// TODO will need to pass a mode to the above function to only use subscores for hte appropriate mode
foreach ($entries as $entry) {
$entry->final_score_array = $this->scoreService->entryTotalScores($entry);
$entry->scoring_complete = ($this->scoreService->entryScoreSheetCounts()[$entry->id] == $audition->judges_count);
@ -69,18 +69,20 @@ class TabulationService
return 0;
});
//TODO verify this actually sorts by subscores correctly
// Assign a rank to each entry. In the case of a declined seat by a doubler, indicate as so and do not increment rank
$n = 1;
/** @var Entry $entry */
foreach ($entries as $entry) {
if (! $entry->hasFlag('declined')) {
if (! $entry->hasFlag('declined') or $mode != 'seating') {
$entry->rank = $n;
$n++;
} else {
$entry->rank = $n.' - declined';
}
}
$cache[$auditionId] = $entries->keyBy('id');
return $entries->keyBy('id');
@ -167,7 +169,6 @@ class TabulationService
$audition->scored_entries_count = $scored_entries_count;
}
return $auditions;
});

View File

@ -1,4 +1,4 @@
@props(['name','label','description' => '', 'checked' => false])
@props(['name','label' => false,'description' => '', 'checked' => false])
<div class="relative flex items-start">
<div class="flex h-6 items-center">
<input id="{{ $name }}"
@ -6,11 +6,13 @@
name="{{ $name }}"
type="checkbox"
@if($checked) checked @endif
class="h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600">
{{ $attributes->merge(['class' => "h-4 w-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-600"]) }}>
</div>
<div class="ml-3 text-sm leading-6">
<label for="{{ $name }}" class="font-medium text-gray-900">{{ $label }}</label>
<p id="comments-description" class="text-gray-500">{{ $description }}</p>
@if($label)
<label for="{{ $name }}" class="font-medium text-gray-900">{{ $label }}</label>
<p id="comments-description" class="text-gray-500">{{ $description }}</p>
@endif
@error($name)
<p class="text-xs text-red-500 font-semibold mt-1 ml-3">{{ $message }}</p>
@enderror

View File

@ -1,22 +1,42 @@
<x-layout.app>
<x-slot:page_title>{{ auditionSetting('advanceTo') }} Advancement - {{ $audition->name }}</x-slot:page_title>
<div class="grid grid-cols-4"></div>
<div class="grid grid-cols-4">
<div class="grid grid-cols-4" x-data="checkboxSelector()">
<div class="col-span-3">
@include('tabulation.advancement.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--}}
@if($scoringComplete)
<x-card.card>
<x-card.heading>Pass Entries</x-card.heading>
<div class="mx-6 mt-3">
<x-form.field name="markrows"
type="number"
label_text="Mark entries ranked 1 through"
x-model="numberOfCheckboxes"/>
<div class="flex justify-between mb-3">
<div></div>
<x-form.button type="button" class="mt-2" @click="checkCheckboxes">Mark</x-form.button>
</div>
</div>
</x-card.card>
@endif
</div>
<script>
function checkboxSelector() {
return {
numberOfCheckboxes: 0,
checkCheckboxes() {
const checkboxes = document.querySelectorAll('.checkbox');
checkboxes.forEach((checkbox, index) => {
checkbox.checked = index < this.numberOfCheckboxes;
});
}
}
}
</script>
</div>

View File

@ -8,6 +8,9 @@
<x-table.th>Student Name</x-table.th>
<x-table.th>Total Score</x-table.th>
<x-table.th>All Scores?</x-table.th>
@if($scoringComplete)
<x-table.th>Pass?</x-table.th>
@endif
</tr>
</thead>
@ -15,6 +18,24 @@
@foreach($entries 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 class="flex flex-col">
<span>{{ $entry->student->full_name() }}</span>
<span class="text-xs text-gray-400">{{ $entry->student->school->name }}</span>
</x-table.td>
<x-table.td>{{ number_format($entry->final_score_array[0] ?? 0,4) }}</x-table.td>
<x-table.td>
@if($entry->scoring_complete)
<x-icons.checkmark color="green"/>
@endif
</x-table.td>
@if($scoringComplete)
<x-table.td>
<x-form.checkbox name="pass-{{$entry->id}}" x-ref="checkboxes" class="checkbox"></x-form.checkbox>
</x-table.td>
@endif
</tr>
@endforeach
</x-table.body>