Cleanup work on scoring guides and rooms

This commit is contained in:
Matt Young 2024-06-05 00:51:31 -05:00
parent 73eede9fe2
commit 0ac37b6879
5 changed files with 11 additions and 4 deletions

View File

@ -13,8 +13,8 @@ class RoomController extends Controller
public function index() public function index()
{ {
if(! Auth::user()->is_admin) abort(403); if(! Auth::user()->is_admin) abort(403);
$unassignedAuditions = Audition::with('entries')->where('room_id','=','0')->orderBy('score_order')->get(); #$unassignedAuditions = Audition::with('entries')->where('room_id','=','0')->orderBy('score_order')->get();
$rooms = Room::with('auditions.entries')->orderBy('name')->get(); $rooms = Room::with('auditions.entries')->orderBy('name')->get();
return view('admin.rooms.index', ['rooms' => $rooms, 'unassignedAuditions' => $unassignedAuditions]); return view('admin.rooms.index', ['rooms' => $rooms]);
} }
} }

View File

@ -15,4 +15,9 @@ class ScoringGuide extends Model
{ {
return $this->hasMany(Audition::class)->orderBy('score_order'); return $this->hasMany(Audition::class)->orderBy('score_order');
} }
public function subscores(): HasMany
{
return $this->hasMany(SubscoreDefinition::class);
}
} }

View File

@ -17,7 +17,8 @@ class RoomFactory extends Factory
public function definition(): array public function definition(): array
{ {
return [ return [
// 'name' => 'Room ' . fake()->numberBetween(7,500),
'description' => fake()->sentence()
]; ];
} }
} }

View File

@ -54,3 +54,4 @@
</tr> </tr>
</tfoot> </tfoot>
</x-table.table> </x-table.table>
{{-- TODO need to be able to edit subscores --}}

View File

@ -17,7 +17,7 @@
@continue @continue
@endif @endif
<tr> <tr>
<x-table.td>{{ $guide->name }}</x-table.td> <x-table.td>{{ $guide->name }} <span class="text-xs text-gray-400">{{ $guide->subscores->count() }} subscores</span></x-table.td>
<x-table.td class="text-right text-indigo-600"><a href="/admin/scoring/guides/{{ $guide->id }}/edit">Edit</a></x-table.td> <x-table.td class="text-right text-indigo-600"><a href="/admin/scoring/guides/{{ $guide->id }}/edit">Edit</a></x-table.td>
{{-- TODO add a link to delete if the guide is not in use--}} {{-- TODO add a link to delete if the guide is not in use--}}
</tr> </tr>