Users can only get a score sheet for an entry they are assigned to judge

This commit is contained in:
Matt Young 2024-06-27 15:48:15 -05:00
parent bfe15d47bf
commit e948bfe0c5
1 changed files with 4 additions and 2 deletions

View File

@ -37,9 +37,11 @@ class JudgingController extends Controller
return view('judging.audition_entry_list', compact('audition', 'entries', 'subscores', 'votes')); return view('judging.audition_entry_list', compact('audition', 'entries', 'subscores', 'votes'));
} }
public function entryScoreSheet(Entry $entry) public function entryScoreSheet(Request $request, Entry $entry)
{ {
// TODO verify user is assigned to judge this audition if ($request->user()->cannot('judge', $entry->audition)) {
return redirect()->route('judging.index')->with('error', 'You are not assigned to judge this entry');
}
$oldSheet = ScoreSheet::where('user_id', Auth::id())->where('entry_id', $entry->id)->value('subscores') ?? null; $oldSheet = ScoreSheet::where('user_id', Auth::id())->where('entry_id', $entry->id)->value('subscores') ?? null;
$oldVote = JudgeAdvancementVote::where('user_id', Auth::id())->where('entry_id', $entry->id)->first(); $oldVote = JudgeAdvancementVote::where('user_id', Auth::id())->where('entry_id', $entry->id)->first();
$oldVote = $oldVote ? $oldVote->vote : 'novote'; $oldVote = $oldVote ? $oldVote->vote : 'novote';