Users can only get a judging entry list for auditions they are judging
This commit is contained in:
parent
8a033cad97
commit
bfe15d47bf
|
|
@ -24,9 +24,11 @@ class JudgingController extends Controller
|
||||||
return view('judging.index', compact('rooms'));
|
return view('judging.index', compact('rooms'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function auditionEntryList(Audition $audition)
|
public function auditionEntryList(Request $request, Audition $audition)
|
||||||
{
|
{
|
||||||
// TODO verify user is assigned to judge this audition
|
if ($request->user()->cannot('judge', $audition)) {
|
||||||
|
return redirect()->route('judging.index')->with('error', 'You are not assigned to judge this audition');
|
||||||
|
}
|
||||||
$entries = Entry::where('audition_id', '=', $audition->id)->orderBy('draw_number')->with('audition')->get();
|
$entries = Entry::where('audition_id', '=', $audition->id)->orderBy('draw_number')->with('audition')->get();
|
||||||
$subscores = $audition->scoringGuide->subscores()->orderBy('display_order')->get();
|
$subscores = $audition->scoringGuide->subscores()->orderBy('display_order')->get();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,4 +63,9 @@ class AuditionPolicy
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function judge(User $user, Audition $audition): bool
|
||||||
|
{
|
||||||
|
return $user->rooms->contains($audition->room_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
@php
|
@php
|
||||||
$oldScores = session()->get('oldScores') ?? null;
|
$oldScores = session()->get('oldScores') ?? null;
|
||||||
// TODO get old vote
|
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
<x-slot:page_title>Entry Dashboard</x-slot:page_title>
|
<x-slot:page_title>Entry Dashboard</x-slot:page_title>
|
||||||
|
|
|
||||||
|
|
@ -16,28 +16,9 @@
|
||||||
<x-layout.app>
|
<x-layout.app>
|
||||||
<x-slot:page_title>Test Page</x-slot:page_title>
|
<x-slot:page_title>Test Page</x-slot:page_title>
|
||||||
@php
|
@php
|
||||||
dump($auditionService->getAuditions());
|
dump(Auth::user()->rooms->contains(1));
|
||||||
@endphp
|
@endphp
|
||||||
<x-table.table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<x-table.th>Name</x-table.th>
|
|
||||||
<x-table.th>Total Entries</x-table.th>
|
|
||||||
<x-table.th>Seating Entries</x-table.th>
|
|
||||||
<x-table.th>Advancement Entries</x-table.th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
@foreach($auditionService->getAuditions() as $a)
|
|
||||||
<tr>
|
|
||||||
<x-table.td>{{ $a->name }}</x-table.td>
|
|
||||||
<x-table.td>{{ $a->entries_count }}</x-table.td>
|
|
||||||
<x-table.td>{{ $a->seating_entries_count }}</x-table.td>
|
|
||||||
<x-table.th>{{ $a->advancement_entries_count }}</x-table.th>
|
|
||||||
</tr>
|
|
||||||
@endforeach
|
|
||||||
</tbody>
|
|
||||||
</x-table.table>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue