Auditionadmin 20 - Bonus scores are fully functional #25

Merged
okorpheus merged 16 commits from auditionadmin-20 into master 2024-07-16 08:04:08 +00:00
3 changed files with 56 additions and 4 deletions
Showing only changes of commit 475ac181c6 - Show all commits

View File

@ -30,10 +30,11 @@ class JudgingController extends Controller
public function index()
{
$rooms = Auth::user()->judgingAssignments;
$rooms->load('auditions');
$rooms = Auth::user()->judgingAssignments()->with('auditions')->get();
$bonusScoresToJudge = Auth::user()->bonusJudgingAssignments()->with('auditions')->get();
return view('judging.index', compact('rooms'));
//$rooms->load('auditions');
return view('judging.index', compact('rooms', 'bonusScoresToJudge'));
}
public function auditionEntryList(Request $request, Audition $audition)

View File

@ -1,7 +1,8 @@
<x-layout.app>
<x-slot:page_title>Judging Dashboard</x-slot:page_title>
<h2 class="overflow-hidden mx-auto max-w-md py-3 px-1 text-base font-semibold leading-7 text-gray-900">Choose auditon to judge</h2>
<h2 class="overflow-hidden mx-auto max-w-md py-3 px-1 text-base font-semibold leading-7 text-gray-900">Choose
audition to judge</h2>
@foreach($rooms as $room)
<x-card.card class="mx-auto max-w-md mb-3">
@ -16,5 +17,20 @@
</x-card.card>
@endforeach
@foreach($bonusScoresToJudge as $bonusScore)
<x-card.card class="mx-auto max-w-md mb-3">
<x-card.heading>{{ $bonusScore->name }}</x-card.heading>
<x-card.list.body>
@foreach($bonusScore->auditions as $audition)
<a href="#">
<x-card.list.row class="!py-3 ml-3">
{{ $audition->name }}
</x-card.list.row>
</a>
@endforeach
</x-card.list.body>
</x-card.card>
@endforeach
</x-layout.app>

View File

@ -1,6 +1,7 @@
<?php
use App\Models\Audition;
use App\Models\BonusScoreDefinition;
use App\Models\Entry;
use App\Models\Room;
use App\Models\ScoringGuide;
@ -113,3 +114,37 @@ it('does not show the user room and auditions they are not assigned to judge', f
->assertDontSee($otherRoom->name)
->assertDontSee($otherAudition->name);
});
it('shows bonus scores the user is assigned to judge', function () {
// Arrange
$bonusScore = BonusScoreDefinition::factory()->create();
$judge = User::factory()->create();
$bonusScore->judges()->attach($judge);
$this->actingAs($judge);
// Act & Assert
$this->get(route('judging.index'))
->assertSee($bonusScore->name);
});
it('does not show bonus scores the user is not assigned to judge', function () {
// Arrange
$bonusScore = BonusScoreDefinition::factory()->create();
$otherBonusScore = BonusScoreDefinition::factory()->create();
$judge = User::factory()->create();
$bonusScore->judges()->attach($judge);
$this->actingAs($judge);
// Act & Assert
$this->get(route('judging.index'))
->assertSee($bonusScore->name)
->assertDontSee($otherBonusScore->name);
});
it('shows auditions in a bonus score assignment', function () {
// Arrange
$bonusScore = BonusScoreDefinition::factory()->create();
$audition = Audition::factory()->create();
$bonusScore->auditions()->attach($audition);
$judge = User::factory()->create();
$bonusScore->judges()->attach($judge);
$this->actingAs($judge);
// Act & Assert
$this->get(route('judging.index'))
->assertSee($audition->name);
});