Compare commits

..

No commits in common. "master" and "import_function" have entirely different histories.

35 changed files with 440 additions and 805 deletions

View File

@ -78,15 +78,11 @@ class PrintSignInSheets
public function addEntryRow(Entry $entry) public function addEntryRow(Entry $entry)
{ {
$nameLine = $entry->student->full_name();
if ($entry->student->isDoublerInEvent($entry->audition->event_id)) {
$nameLine .= ' (D)';
}
$this->pdf->Cell($this->columnWidth['id'], $this->bodyRowHeight, $entry->id, 1, 0, 'L'); $this->pdf->Cell($this->columnWidth['id'], $this->bodyRowHeight, $entry->id, 1, 0, 'L');
$this->pdf->Cell($this->columnWidth['instrument'], $this->bodyRowHeight, $entry->audition->name, 1, 0, $this->pdf->Cell($this->columnWidth['instrument'], $this->bodyRowHeight, $entry->audition->name, 1, 0,
'L'); 'L');
$this->pdf->Cell($this->columnWidth['drawNumber'], $this->bodyRowHeight, $entry->draw_number, 1, 0, 'L'); $this->pdf->Cell($this->columnWidth['drawNumber'], $this->bodyRowHeight, $entry->draw_number, 1, 0, 'L');
$this->pdf->Cell($this->columnWidth['name'], $this->bodyRowHeight, $nameLine, 1, 0, 'L'); $this->pdf->Cell($this->columnWidth['name'], $this->bodyRowHeight, $entry->student->full_name(), 1, 0, 'L');
$this->pdf->Cell($this->columnWidth['school'], $this->bodyRowHeight, $entry->student->school->name, 1, 0, 'L'); $this->pdf->Cell($this->columnWidth['school'], $this->bodyRowHeight, $entry->student->school->name, 1, 0, 'L');
$this->pdf->Cell(0, $this->bodyRowHeight, ' ', 1, 1, 'L'); $this->pdf->Cell(0, $this->bodyRowHeight, ' ', 1, 1, 'L');
} }

View File

@ -58,37 +58,17 @@ class QuarterPageCards implements PrintCards
$this->pdf->Cell(4.5, .5, $entry->audition->name.' #'.$entry->draw_number); $this->pdf->Cell(4.5, .5, $entry->audition->name.' #'.$entry->draw_number);
// Fill in student information // Fill in student information
$nameLine = $entry->student->full_name();
if ($entry->student->isDoublerInEvent($entry->audition->event_id)) {
$nameLine .= ' (D)';
}
$this->pdf->SetFont('Arial', '', 10); $this->pdf->SetFont('Arial', '', 10);
$xLoc = $this->offset[$this->quadOn][0] + 1; $xLoc = $this->offset[$this->quadOn][0] + 1;
$yLoc = $this->offset[$this->quadOn][1] + 3.1; $yLoc = $this->offset[$this->quadOn][1] + 3.1;
$this->pdf->setXY($xLoc, $yLoc); $this->pdf->setXY($xLoc, $yLoc);
$this->pdf->Cell(4.5, .25, $nameLine); $this->pdf->Cell(4.5, .25, $entry->student->full_name());
$this->pdf->setXY($xLoc, $yLoc + .25); $this->pdf->setXY($xLoc, $yLoc + .25);
$this->pdf->Cell(4.5, .25, $entry->student->school->name); $this->pdf->Cell(4.5, .25, $entry->student->school->name);
$this->pdf->setXY($xLoc, $yLoc + .5); $this->pdf->setXY($xLoc, $yLoc + .5);
if (! is_null($entry->audition->room_id)) { if (! is_null($entry->audition->room_id)) {
$this->pdf->Cell(4.5, .25, $entry->audition->room->name); $this->pdf->Cell(4.5, .25, $entry->audition->room->name);
} }
if (auditionSetting('advanceTo')) {
$as = false;
$this->pdf->setXY($xLoc, $yLoc - 1);
$auditioningFor = 'Auditioning for: ';
if ($entry->for_seating) {
$auditioningFor .= auditionSetting('auditionAbbreviation');
$as = true;
}
if ($entry->for_advancement) {
if ($as) {
$auditioningFor .= ' / ';
}
$auditioningFor .= auditionSetting('advanceTo');
}
$this->pdf->Cell(4.5, .25, $auditioningFor);
}
$this->quadOn++; $this->quadOn++;
} }

View File

@ -33,7 +33,7 @@ class GetExportData
foreach ($events as $event) { foreach ($events as $event) {
$auditions = $event->auditions; $auditions = $event->auditions;
foreach ($auditions as $audition) { foreach ($auditions as $audition) {
$entries = $ranker($audition, 'seating'); $entries = $ranker->rank('seating', $audition);
foreach ($entries as $entry) { foreach ($entries as $entry) {
$thisRow = $audition->name.','; $thisRow = $audition->name.',';
$thisRow .= $entry->raw_rank ?? ''; $thisRow .= $entry->raw_rank ?? '';
@ -41,7 +41,7 @@ class GetExportData
$thisRow .= $entry->student->full_name().','; $thisRow .= $entry->student->full_name().',';
$thisRow .= $entry->student->school->name.','; $thisRow .= $entry->student->school->name.',';
$thisRow .= $entry->student->grade.','; $thisRow .= $entry->student->grade.',';
$thisRow .= $entry->totalScore->seating_total ?? ''; $thisRow .= $entry->score_totals[0] ?? '';
$thisRow .= ','; $thisRow .= ',';
if ($entry->hasFlag('failed_prelim')) { if ($entry->hasFlag('failed_prelim')) {
$thisRow .= 'Failed Prelim'; $thisRow .= 'Failed Prelim';

View File

@ -24,7 +24,7 @@ class RankAuditionEntries
* *
* @throws AuditionAdminException * @throws AuditionAdminException
*/ */
public function __invoke(Audition $audition, string $rank_type, bool $pullDeclinedEntries = true): Collection|Entry public function __invoke(Audition $audition, string $rank_type): Collection|Entry
{ {
if ($rank_type !== 'seating' && $rank_type !== 'advancement') { if ($rank_type !== 'seating' && $rank_type !== 'advancement') {
throw new AuditionAdminException('Invalid rank type (must be seating or advancement)'); throw new AuditionAdminException('Invalid rank type (must be seating or advancement)');
@ -33,8 +33,8 @@ class RankAuditionEntries
$cache_duration = 15; $cache_duration = 15;
if ($rank_type === 'seating') { if ($rank_type === 'seating') {
return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition, $pullDeclinedEntries) { return cache()->remember('rank_seating_'.$audition->id, $cache_duration, function () use ($audition) {
return $this->get_seating_ranks($audition, $pullDeclinedEntries); return $this->get_seating_ranks($audition);
}); });
} }
@ -44,7 +44,7 @@ class RankAuditionEntries
} }
private function get_seating_ranks(Audition $audition, bool $pullDeclinedEntries = true): Collection|Entry private function get_seating_ranks(Audition $audition): Collection|Entry
{ {
if ($audition->bonusScore()->count() > 0) { if ($audition->bonusScore()->count() > 0) {
$totalColumn = 'seating_total_with_bonus'; $totalColumn = 'seating_total_with_bonus';
@ -53,7 +53,6 @@ class RankAuditionEntries
} }
$sortedEntries = $audition->entries() $sortedEntries = $audition->entries()
->where('for_seating', true)
->whereHas('totalScore') ->whereHas('totalScore')
->with('totalScore') ->with('totalScore')
->with('student.school') ->with('student.school')
@ -75,7 +74,7 @@ class RankAuditionEntries
$rankOn = 1; $rankOn = 1;
foreach ($sortedEntries as $entry) { foreach ($sortedEntries as $entry) {
if ($entry->hasFlag('declined') && $pullDeclinedEntries) { if ($entry->hasFlag('declined')) {
$entry->seatingRank = 'declined'; $entry->seatingRank = 'declined';
} else { } else {
$entry->seatingRank = $rankOn; $entry->seatingRank = $rankOn;

View File

@ -65,14 +65,14 @@ class YearEndCleanup
if (is_array($options)) { if (is_array($options)) {
if (in_array('deleteRooms', $options)) { if (in_array('deleteRooms', $options)) {
DB::table('auditions')->update(['room_id' => 0]); DB::table('auditions')->update(['room_id' => null]);
DB::table('auditions')->update(['order_in_room' => '0']); DB::table('auditions')->update(['order_in_room' => '0']);
DB::table('room_user')->truncate(); DB::table('room_user')->truncate();
DB::table('rooms')->where('id', '>', 0)->delete(); DB::table('rooms')->delete();
} }
if (in_array('removeAuditionsFromRoom', $options)) { if (in_array('removeAuditionsFromRoom', $options)) {
DB::table('auditions')->update(['room_id' => 0]); DB::table('auditions')->update(['room_id' => null]);
DB::table('auditions')->update(['order_in_room' => '0']); DB::table('auditions')->update(['order_in_room' => '0']);
} }

View File

@ -1,41 +0,0 @@
<?php
namespace App\Console\Commands;
use App\Actions\Tabulation\EnterScore;
use App\Models\ScoreSheet;
use Illuminate\Console\Command;
class RecalculateJudgeTotalsCommand extends Command
{
protected $signature = 'audition:recalculate-judge-totals';
protected $description = 'Recalculates total scores for all score sheets for unpubished auditions';
public function handle(): void
{
$this->info('Starting score recalculation...');
$scoreSheets = ScoreSheet::all();
foreach ($scoreSheets as $scoreSheet) {
if ($scoreSheet->entry->audition->hasFlag('seats_published')) {
continue;
}
$this->recalculate($scoreSheet);
}
$this->info('Score recalculation completed successfully.');
}
private function recalculate(ScoreSheet|int $scoreSheet): void
{
if (is_int($scoreSheet)) {
$scoreSheet = ScoreSheet::findOrFail($scoreSheet);
}
$scribe = app()->make(EnterScore::class);
$scoreSubmission = [];
foreach ($scoreSheet->subscores as $subscore) {
$scoreSubmission[$subscore['subscore_id']] = $subscore['score'];
}
$scribe($scoreSheet->judge, $scoreSheet->entry, $scoreSubmission, $scoreSheet);
}
}

View File

@ -8,14 +8,14 @@ use Illuminate\Console\Command;
/** /**
* @codeCoverageIgnore * @codeCoverageIgnore
*/ */
class RecalculateTotalScores extends Command class RecalculateScores extends Command
{ {
/** /**
* The name and signature of the console command. * The name and signature of the console command.
* *
* @var string * @var string
*/ */
protected $signature = 'audition:recalculate-total-scores'; protected $signature = 'audition:recalculate-scores';
/** /**
* The console command description. * The console command description.

View File

@ -28,14 +28,10 @@ class PrintCards extends Controller
public function print(\App\Actions\Print\PrintCards $printer) public function print(\App\Actions\Print\PrintCards $printer)
{ {
//dump(request()->all()); //dump(request()->all());
// if (request()->audition == null) { if (request()->audition == null) {
// return redirect()->back()->with('error', 'You must specify at least one audition'); return redirect()->back()->with('error', 'You must specify at least one audition');
// }
if (request()->audition) {
$selectedAuditionIds = array_keys(request()->audition);
} else {
$selectedAuditionIds = [];
} }
$selectedAuditionIds = array_keys(request()->audition);
$cardQuery = Entry::whereIn('audition_id', $selectedAuditionIds); $cardQuery = Entry::whereIn('audition_id', $selectedAuditionIds);
// Process Filters // Process Filters

View File

@ -1,16 +0,0 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Models\School;
class SchoolEmailDomainController extends Controller
{
public function index()
{
$schools = School::with('emailDomains')->get();
return view('admin.schools.email_domains_index', compact('schools'));
}
}

View File

@ -110,10 +110,6 @@ class ScoringGuideController extends Controller
'Cannot update a subscore for a different scoring guide'); 'Cannot update a subscore for a different scoring guide');
} }
$validateData = $validateData = $request->validated(); $validateData = $validateData = $request->validated();
if (! auditionSetting('advanceTo')) {
$validateData['for_advance'] = 0;
$validateData['for_seating'] = 1;
}
$subscore->update([ $subscore->update([
'name' => $validateData['name'], 'name' => $validateData['name'],

View File

@ -15,12 +15,9 @@ use App\Models\AuditLogEntry;
use App\Models\School; use App\Models\School;
use App\Models\User; use App\Models\User;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use function auditionLog;
class UserController extends Controller class UserController extends Controller
{ {
public function index() public function index()
@ -34,8 +31,7 @@ class UserController extends Controller
{ {
$schools = School::orderBy('name')->get(); $schools = School::orderBy('name')->get();
$logEntries = AuditLogEntry::whereJsonContains('affected->users', $user->id)->orderBy('created_at', $logEntries = AuditLogEntry::whereJsonContains('affected->users', $user->id)->orderBy('created_at', 'desc')->get();
'desc')->get();
$userActions = AuditLogEntry::where('user', $user->email)->orderBy('created_at', 'desc')->get(); $userActions = AuditLogEntry::where('user', $user->email)->orderBy('created_at', 'desc')->get();
return view('admin.users.edit', compact('user', 'schools', 'logEntries', 'userActions')); return view('admin.users.edit', compact('user', 'schools', 'logEntries', 'userActions'));
@ -126,22 +122,4 @@ class UserController extends Controller
return redirect()->route('admin.users.index')->with('success', 'User deleted successfully'); return redirect()->route('admin.users.index')->with('success', 'User deleted successfully');
} }
public function setPassword(User $user, Request $request)
{
$validated = $request->validate([
'admin_password' => ['required', 'string', 'current_password:web'],
'new_password' => ['required', 'string', 'confirmed', 'min:8'],
]);
$user->forceFill([
'password' => Hash::make($validated['new_password']),
])->save();
auditionLog('Manually set password for '.$user->email, [
'users' => [$user->id],
]);
return redirect()->route('admin.users.index')->with('success',
'Password changed successfully for '.$user->email);
}
} }

View File

@ -3,7 +3,6 @@
namespace App\Http\Controllers\Judging; namespace App\Http\Controllers\Judging;
use App\Actions\Tabulation\EnterScore; use App\Actions\Tabulation\EnterScore;
use App\Exceptions\AuditionAdminException;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Audition; use App\Models\Audition;
use App\Models\Entry; use App\Models\Entry;
@ -101,11 +100,7 @@ class JudgingController extends Controller
// Enter the score // Enter the score
/** @noinspection PhpUnhandledExceptionInspection */ /** @noinspection PhpUnhandledExceptionInspection */
try {
$enterScore(Auth::user(), $entry, $validatedData['score']); $enterScore(Auth::user(), $entry, $validatedData['score']);
} catch (AuditionAdminException $e) {
return redirect()->back()->with('error', $e->getMessage());
}
// Deal with an advancement vote if needed // Deal with an advancement vote if needed
$this->advancementVote($request, $entry); $this->advancementVote($request, $entry);

View File

@ -45,15 +45,7 @@ class PrelimJudgingController extends Controller
$oldSheet = PrelimScoreSheet::where('user_id', Auth::id())->where('entry_id', $oldSheet = PrelimScoreSheet::where('user_id', Auth::id())->where('entry_id',
$entry->id)->value('subscores') ?? null; $entry->id)->value('subscores') ?? null;
if ($oldSheet) { return view('judging.prelim_entry_form', compact('entry', 'oldSheet'));
$formRoute = 'update.savePrelimScoreSheet';
$formMethod = 'PATCH';
} else {
$formRoute = 'judging.savePrelimScoreSheet';
$formMethod = 'POST';
}
return view('judging.prelim_entry_form', compact('entry', 'oldSheet', 'formRoute', 'formMethod'));
} }
/** /**

View File

@ -73,7 +73,7 @@ class AdvancementController extends Controller
$entries = $ranker($audition, 'advancement'); $entries = $ranker($audition, 'advancement');
$entries->load(['advancementVotes', 'totalScore', 'student.school']); $entries->load(['advancementVotes', 'totalScore', 'student.school']);
$unscoredEntries = $audition->entries()->where('for_advancement', true)->orderBy('draw_number')->get()->filter(function ($entry) { $unscoredEntries = $audition->entries()->orderBy('draw_number')->get()->filter(function ($entry) {
return ! $entry->totalScore && ! $entry->hasFlag('no_show'); return ! $entry->totalScore && ! $entry->hasFlag('no_show');
}); });
@ -81,7 +81,7 @@ class AdvancementController extends Controller
return $entry->hasFlag('no_show'); return $entry->hasFlag('no_show');
}); });
$scoringComplete = $audition->entries->where('for_advancement', true)->every(function ($entry) { $scoringComplete = $audition->entries->every(function ($entry) {
return $entry->totalScore || $entry->hasFlag('no_show'); return $entry->totalScore || $entry->hasFlag('no_show');
}); });

View File

@ -29,7 +29,7 @@ class Entry extends Model
/** /**
* @throws AuditionAdminException * @throws AuditionAdminException
*/ */
public function rank(string $type, bool $pullDeclinedEntries = true) public function rank(string $type)
{ {
$ranker = app(RankAuditionEntries::class); $ranker = app(RankAuditionEntries::class);
@ -39,11 +39,11 @@ class Entry extends Model
} }
// Get the ranked entries for this entries audition // Get the ranked entries for this entries audition
$rankedEntries = $ranker($this->audition, $type, $pullDeclinedEntries); $rankedEntries = $ranker($this->audition, $type);
// If we're looking for seating rank, return the rank from the list of ranked entries // If we're looking for seating rank, return the rank from the list of ranked entries
if ($type === 'seating') { if ($type === 'seating') {
return $rankedEntries->where('id', $this->id)->first()->seatingRank ?? 'No Rank'; return $rankedEntries->where('id', $this->id)->first()->seatingRank;
} }
return $rankedEntries->where('id', $this->id)->first()->advancementRank; return $rankedEntries->where('id', $this->id)->first()->advancementRank;

View File

@ -35,7 +35,7 @@ class InvoiceOneFeePerStudent implements InvoiceDataService
/** @noinspection PhpArrayIndexImmediatelyRewrittenInspection */ /** @noinspection PhpArrayIndexImmediatelyRewrittenInspection */
$invoiceData['grandTotal'] = 0; $invoiceData['grandTotal'] = 0;
$entries = $school->entries()->where('for_seating', true)->with('audition')->orderBy('created_at', 'desc')->get()->groupBy('student_id'); $entries = $school->entries()->with('audition')->orderBy('created_at', 'desc')->get()->groupBy('student_id');
foreach ($school->students as $student) { foreach ($school->students as $student) {
$firstEntryForStudent = true; $firstEntryForStudent = true;
foreach ($entries[$student->id] ?? [] as $entry) { foreach ($entries[$student->id] ?? [] as $entry) {

View File

@ -35,7 +35,7 @@ class InvoiceOneFeePerStudentPerEvent implements InvoiceDataService
/** @noinspection PhpArrayIndexImmediatelyRewrittenInspection */ /** @noinspection PhpArrayIndexImmediatelyRewrittenInspection */
$invoiceData['grandTotal'] = 0; $invoiceData['grandTotal'] = 0;
$entries = $school->entries()->where('for_seating', true)->with('audition')->orderBy('created_at', 'desc')->get()->groupBy('student_id'); $entries = $school->entries()->with('audition')->orderBy('created_at', 'desc')->get()->groupBy('student_id');
foreach ($school->students as $student) { foreach ($school->students as $student) {
$eventsEntered = []; $eventsEntered = [];
foreach ($entries[$student->id] ?? [] as $entry) { foreach ($entries[$student->id] ?? [] as $entry) {

4
composer.lock generated
View File

@ -10004,12 +10004,12 @@
], ],
"aliases": [], "aliases": [],
"minimum-stability": "stable", "minimum-stability": "stable",
"stability-flags": {}, "stability-flags": [],
"prefer-stable": true, "prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^8.2" "php": "^8.2"
}, },
"platform-dev": {}, "platform-dev": [],
"plugin-api-version": "2.6.0" "plugin-api-version": "2.6.0"
} }

View File

@ -78,7 +78,7 @@ return [
'url' => env('LOG_SLACK_WEBHOOK_URL'), 'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'), 'username' => env('LOG_SLACK_USERNAME', 'Laravel Log'),
'emoji' => env('LOG_SLACK_EMOJI', ':boom:'), 'emoji' => env('LOG_SLACK_EMOJI', ':boom:'),
'level' => env('LOG_LEVEL', 'debug'), 'level' => env('LOG_LEVEL', 'critical'),
'replace_placeholders' => true, 'replace_placeholders' => true,
], ],

735
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,6 @@
</include> </include>
</source> </source>
<php> <php>
<ini name="memory_limit" value="512M"/>
<env name="APP_ENV" value="testing"/> <env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_DRIVER" value="file"/> <env name="APP_MAINTENANCE_DRIVER" value="file"/>
<env name="BCRYPT_ROUNDS" value="4"/> <env name="BCRYPT_ROUNDS" value="4"/>

View File

@ -1,30 +0,0 @@
<x-layout.app>
<x-slot:page_title>School Email Domains</x-slot:page_title>
<x-card.card class="max-w-2xl mx-auto">
<x-card.heading>School Email Domains</x-card.heading>
<x-table.table>
<thead>
<tr>
<x-table.th>School</x-table.th>
<x-table.th>Domains</x-table.th>
</tr>
</thead>
<x-table.body>
@foreach($schools as $school)
<tr>
<x-table.td>
<a href="{{ route('admin.schools.show', $school) }}">
{{ $school->name }}
</a>
</x-table.td>
<x-table.td>
@foreach($school->emailDomains ?? [] as $domain)
{{ $domain->domain }}
@endforeach
</x-table.td>
</tr>
@endforeach
</x-table.body>
</x-table.table>
</x-card.card>
</x-layout.app>

View File

@ -54,21 +54,6 @@
</x-form.form> </x-form.form>
</x-card.card> </x-card.card>
<x-card.card class="max-w-lg mx-auto mt-5" x-data="{ showPasswordForm: false}">
<x-card.heading @click="showPasswordForm = !showPasswordForm">
Manually Set Password
</x-card.heading>
<div class="mb-5 mt-3" x-cloak x-show="showPasswordForm">
<x-form.form method="POST" action="{{ route('admin.users.setPassword', $user) }}">
<x-form.field name="admin_password" label_text="YOUR password" type="password"/>
<x-form.field name="new_password" label_text="New password for {{ $user->email }}" type="password"/>
<x-form.field name="new_password_confirmation" label_text="Confirm new password for {{ $user->email }}"
type="password"/>
<x-form.button class="mt-3">Update Password</x-form.button>
</x-form.form>
</div>
</x-card.card>
<x-card.card class="mt-5"> <x-card.card class="mt-5">
<x-card.heading>User Actions</x-card.heading> <x-card.heading>User Actions</x-card.heading>
<x-table.table> <x-table.table>

View File

@ -13,7 +13,8 @@
<tr> <tr>
<x-table.th>Name</x-table.th> <x-table.th>Name</x-table.th>
<x-table.th>School</x-table.th> <x-table.th>School</x-table.th>
<x-table.th>Cell Phone<br />Email</x-table.th> <x-table.th>Email</x-table.th>
<x-table.th>Cell Phone</x-table.th>
<x-table.th>Judging Preference</x-table.th> <x-table.th>Judging Preference</x-table.th>
<x-table.th>Privileges</x-table.th> <x-table.th>Privileges</x-table.th>
</tr> </tr>
@ -21,16 +22,10 @@
<x-table.body> <x-table.body>
@foreach($users as $user) @foreach($users as $user)
<tr class="hover:bg-gray-50"> <tr class="hover:bg-gray-50">
<x-table.td> <x-table.td><a href="{{ route('admin.users.edit',$user) }}">{{ $user->full_name(true) }}</a>{{ $user->hasFlag('head_director') ? ' *':'' }}</x-table.td>
<a href="{{ route('admin.users.edit',$user) }}">{{ $user->full_name(true) }}</a>
{{ $user->hasFlag('head_director') ? ' *':'' }}
@if(! $user->email_verified_at)
<p class="text-xs font-light">Unverified Account</p>
@endif
</x-table.td>
<x-table.td>{{ $user->has_school() ? $user->school->name : ' ' }}</x-table.td> <x-table.td>{{ $user->has_school() ? $user->school->name : ' ' }}</x-table.td>
<x-table.td>{{ $user->cell_phone }}<br/>{{ $user->email }}</x-table.td> <x-table.td>{{ $user->email }}</x-table.td>
<x-table.td>{{ $user->cell_phone }}</x-table.td>
<x-table.td>{{ $user->judging_preference }}</x-table.td> <x-table.td>{{ $user->judging_preference }}</x-table.td>
<x-table.td> <x-table.td>
@if($user->is_admin) @if($user->is_admin)

View File

@ -2,7 +2,7 @@
<x-layout.page-header>Year End Reset</x-layout.page-header> <x-layout.page-header>Year End Reset</x-layout.page-header>
<x-card.card class="mt-5 max-w-xl m-auto"> <x-card.card class="mt-5 max-w-xl m-auto">
<x-card.heading>Reset Options</x-card.heading> <x-card.heading>Reset Options</x-card.heading>
<x-form.form action="{{ route('admin.execute_year_end_procedures') }}"> <x-form.form action="{{ route('admin.year_end_procedures') }}">
<x-form.checkbox name="options[]" label="Delete Rooms" value="deleteRooms" /> <x-form.checkbox name="options[]" label="Delete Rooms" value="deleteRooms" />
<x-form.checkbox name="options[]" label="Remove Auditions From Rooms" value="removeAuditionsFromRoom" /> <x-form.checkbox name="options[]" label="Remove Auditions From Rooms" value="removeAuditionsFromRoom" />
<x-form.checkbox name="options[]" label="Unassign Judges" value="unassignJudges" /> <x-form.checkbox name="options[]" label="Unassign Judges" value="unassignJudges" />

View File

@ -23,7 +23,6 @@
<a href="{{route('admin.dashboard')}}" class="block p-2 hover:text-indigo-600">Admin Dashboard</a> <a href="{{route('admin.dashboard')}}" class="block p-2 hover:text-indigo-600">Admin Dashboard</a>
<a href="{{route('admin.users.index')}}" class="block p-2 hover:text-indigo-600">Users</a> <a href="{{route('admin.users.index')}}" class="block p-2 hover:text-indigo-600">Users</a>
<a href="{{route('admin.schools.index')}}" class="block p-2 hover:text-indigo-600">Schools</a> <a href="{{route('admin.schools.index')}}" class="block p-2 hover:text-indigo-600">Schools</a>
<a href="{{route('admin.schools.email_domains')}}" class="block p-2 hover:text-indigo-600">School Email Domains</a>
<a href="{{route('admin.students.index')}}" class="block p-2 hover:text-indigo-600">Students</a> <a href="{{route('admin.students.index')}}" class="block p-2 hover:text-indigo-600">Students</a>
<a href="{{route('admin.entries.index')}}" class="block p-2 hover:text-indigo-600">Entries</a> <a href="{{route('admin.entries.index')}}" class="block p-2 hover:text-indigo-600">Entries</a>
@if(auditionSetting('nomination_ensemble_rules') !== 'disabled') @if(auditionSetting('nomination_ensemble_rules') !== 'disabled')

View File

@ -29,14 +29,14 @@
<option value="user">Director</option> <option value="user">Director</option>
<option value="admin" selected>Admin</option> <option value="admin" selected>Admin</option>
</x-form.select> </x-form.select>
<x-layout.navbar.nav-link href="/admin" :active="request()->is('admin')">Dashboard</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin" :active="request()->is('admin')">Dashboard</x-layout.nav-link>
<x-layout.navbar.nav-link href="/admin/users" :active="request()->is('admin/users')">Users</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin/users" :active="request()->is('admin/users')">Users</x-layout.nav-link>
<x-layout.navbar.nav-link href="/admin/schools" :active="request()->is('admin/schools')">Schools</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin/schools" :active="request()->is('admin/schools')">Schools</x-layout.nav-link>
<x-layout.navbar.nav-link href="/admin/students" :active="request()->is('admin/students')">Students</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin/students" :active="request()->is('admin/students')">Students</x-layout.nav-link>
<x-layout.navbar.nav-link href="/admin/entries" :active="request()->is('admin/entries')">Entries</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin/entries" :active="request()->is('admin/entries')">Entries</x-layout.nav-link>
<x-layout.navbar.nav-link href="/admin/auditions" :active="request()->is('admin/auditions')">Auditions</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin/auditions" :active="request()->is('admin/auditions')">Auditions</x-layout.nav-link>
<x-layout.navbar.nav-link href="/admin/scoring" :active="request()->is('admin/scoring')">Scoring</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin/scoring" :active="request()->is('admin/scoring')">Scoring</x-layout.nav-link>
<x-layout.navbar.nav-link href="/admin/rooms" :active="request()->is('admin/rooms')">Rooms</x-layout.navbar.nav-link> <x-layout.nav-link href="/admin/rooms" :active="request()->is('admin/rooms')">Rooms</x-layout.nav-link>
{{-- <a href="/dashboard" class="bg-indigo-700 text-white rounded-md px-3 py-2 text-sm font-medium" aria-current="page">Dashboard</a>--}} {{-- <a href="/dashboard" class="bg-indigo-700 text-white rounded-md px-3 py-2 text-sm font-medium" aria-current="page">Dashboard</a>--}}
{{-- <a href="/students" class="text-white hover:bg-indigo-500 hover:bg-opacity-75 rounded-md px-3 py-2 text-sm font-medium">Students</a>--}} {{-- <a href="/students" class="text-white hover:bg-indigo-500 hover:bg-opacity-75 rounded-md px-3 py-2 text-sm font-medium">Students</a>--}}

View File

@ -53,12 +53,7 @@
<x-layout.page-section> <x-layout.page-section>
<x-slot:section_name>Entry Listing</x-slot:section_name> <x-slot:section_name>Entry Listing</x-slot:section_name>
<x-slot:section_description> <x-slot:section_description>You have {{ $entries->count() }} entries</x-slot:section_description>
You have {{ $entries->count() }} entries <hr />
<p class="mt-3 text-sm">Note on results</p>
<p class="text-sm">Doublers will show declined on all but one entry. The rank shown on this screen does
not account for any doublers that declined a seat in that entries audition.</p>
</x-slot:section_description>
<div class="px-6 md:px-8 py-3"> <div class="px-6 md:px-8 py-3">
<x-table.table> <x-table.table>
<thead> <thead>
@ -72,12 +67,7 @@
@endif @endif
<x-table.th spacer_only> <x-table.th spacer_only>
<span class="sr-only">Edit</span> <span class="sr-only">Edit</span>
</x-table.th> </x-table.th>
<x-table.th>
Seat
</x-table.th>
<x-table.th>Rank</x-table.th>
</tr> </tr>
</thead> </thead>
<x-table.body> <x-table.body>
@ -117,24 +107,6 @@
@endif @endif
</x-table.td> </x-table.td>
@endif @endif
<td></td>
@if($entry->audition->hasFlag('seats_published'))
<td>
@if($entry->seat)
{{ $entry->seat->ensemble->name }} - {{ $entry->seat->seat }}
@else
@if($entry->hasFlag('declined'))
Declined
@else
Not Seated
@endif
@endif
</td>
<td>
{{ $entry->rank('seating', false) }}
</td>
@endif
<x-table.td for_button> <x-table.td for_button>
@php @php

View File

@ -15,9 +15,11 @@
</ul> </ul>
</x-slot:subheading> </x-slot:subheading>
</x-card.heading> </x-card.heading>
<x-form.form method="POST" action="{{ route($formRoute, $entry) }}"> <x-form.form method="POST" action="{{ route('judging.savePrelimScoreSheet', $entry) }}">
@method($formMethod) @if($oldSheet)
{{-- if there are existing scores, make this a patch request --}}
@method('PATCH')
@endif
<x-card.list.body class="mt-1"> <x-card.list.body class="mt-1">
@foreach($entry->audition->prelimDefinition->scoringGuide->subscores()->orderBy('display_order')->get() as $subscore) @foreach($entry->audition->prelimDefinition->scoringGuide->subscores()->orderBy('display_order')->get() as $subscore)
@php @php

View File

@ -8,9 +8,6 @@
<x-table.th>Draw #</x-table.th> <x-table.th>Draw #</x-table.th>
<x-table.th>Student</x-table.th> <x-table.th>Student</x-table.th>
<x-table.th>Doubler</x-table.th> <x-table.th>Doubler</x-table.th>
@if($audition->prelimDefinition)
<x-table.th>Prelim Score</x-table.th>
@endif
<x-table.th>Total Score <x-table.th>Total Score
@if($audition->bonusScore()->count() > 0) @if($audition->bonusScore()->count() > 0)
<br> <br>
@ -62,9 +59,6 @@
</x-table.td> </x-table.td>
@if($audition->prelimDefinition)
<x-table.td>{{ round($entry->prelimTotalScore(),2) }}</x-table.td>
@endif
<x-table.td class="align-top"> <x-table.td class="align-top">
@if($audition->bonusScore()->count() > 0) @if($audition->bonusScore()->count() > 0)
@if($entry->totalScore->bonus_total) @if($entry->totalScore->bonus_total)

View File

@ -19,7 +19,6 @@ use App\Http\Controllers\Admin\PrintStandNameTagsController;
use App\Http\Controllers\Admin\RecapController; use App\Http\Controllers\Admin\RecapController;
use App\Http\Controllers\Admin\RoomController; use App\Http\Controllers\Admin\RoomController;
use App\Http\Controllers\Admin\SchoolController; use App\Http\Controllers\Admin\SchoolController;
use App\Http\Controllers\Admin\SchoolEmailDomainController;
use App\Http\Controllers\Admin\ScoringGuideController; use App\Http\Controllers\Admin\ScoringGuideController;
use App\Http\Controllers\Admin\StudentController; use App\Http\Controllers\Admin\StudentController;
use App\Http\Controllers\Admin\UserController; use App\Http\Controllers\Admin\UserController;
@ -38,7 +37,7 @@ Route::middleware(['auth', 'verified', CheckIfAdmin::class])->prefix('admin/')->
// Year-end procedures // Year-end procedures
Route::get('/year_end_procedures', [YearEndResetController::class, 'index'])->name('admin.year_end_procedures'); Route::get('/year_end_procedures', [YearEndResetController::class, 'index'])->name('admin.year_end_procedures');
Route::post('/year_end_procedures', [YearEndResetController::class, 'execute'])->name('admin.execute_year_end_procedures'); Route::post('/year_end_procedures', [YearEndResetController::class, 'execute'])->name('admin.year_end_procedures');
Route::post('/auditions/roomUpdate', [ Route::post('/auditions/roomUpdate', [
AuditionController::class, 'roomUpdate', AuditionController::class, 'roomUpdate',
@ -169,8 +168,6 @@ Route::middleware(['auth', 'verified', CheckIfAdmin::class])->prefix('admin/')->
}); });
// Admin School Routes // Admin School Routes
Route::get('/schools/email_domains',
[SchoolEmailDomainController::class, 'index'])->name('admin.schools.email_domains');
Route::prefix('schools')->controller(SchoolController::class)->group(function () { Route::prefix('schools')->controller(SchoolController::class)->group(function () {
Route::post('/{school}/add_domain', 'add_domain')->name('admin.schools.add_domain'); Route::post('/{school}/add_domain', 'add_domain')->name('admin.schools.add_domain');
Route::get('/', 'index')->name('admin.schools.index'); Route::get('/', 'index')->name('admin.schools.index');
@ -194,7 +191,6 @@ Route::middleware(['auth', 'verified', CheckIfAdmin::class])->prefix('admin/')->
Route::get('/{user}/edit', 'edit')->name('admin.users.edit'); Route::get('/{user}/edit', 'edit')->name('admin.users.edit');
Route::patch('/{user}', 'update')->name('admin.users.update'); Route::patch('/{user}', 'update')->name('admin.users.update');
Route::delete('/{user}', 'destroy')->name('admin.users.destroy'); Route::delete('/{user}', 'destroy')->name('admin.users.destroy');
Route::post('/{user}/set_password', 'setPassword')->name('admin.users.setPassword');
}); });
// Admin Card Routes // Admin Card Routes

View File

@ -22,7 +22,7 @@ Route::middleware(['auth', 'verified', CheckIfCanJudge::class])->prefix('judging
Route::get('/{prelimDefinition}', 'prelimEntryList')->name('judging.prelimEntryList'); Route::get('/{prelimDefinition}', 'prelimEntryList')->name('judging.prelimEntryList');
route::get('/enterScore/{entry}', 'prelimScoreEntryForm')->name('judging.prelimScoreEntryForm'); route::get('/enterScore/{entry}', 'prelimScoreEntryForm')->name('judging.prelimScoreEntryForm');
route::post('/enterScore/{entry}', 'savePrelimScoreSheet')->name('judging.savePrelimScoreSheet'); route::post('/enterScore/{entry}', 'savePrelimScoreSheet')->name('judging.savePrelimScoreSheet');
route::patch('/enterScore/{entry}', 'updatePrelimScoreSheet')->name('judging.updatePrelimScoreSheet'); route::patch('/enterScore/{entry}', 'updatePrelimScoreSheet')->name('judging.savePrelimScoreSheet');
}); });
// Bonus score judging routes // Bonus score judging routes

View File

@ -25,7 +25,7 @@ it('calls the YearEndCleanup action', function () {
$mock->shouldReceive('__invoke')->once(); $mock->shouldReceive('__invoke')->once();
app()->instance(YearEndCleanup::class, $mock); app()->instance(YearEndCleanup::class, $mock);
actAsAdmin(); actAsAdmin();
$response = $this->post(route('admin.execute_year_end_procedures')); $response = $this->post(route('admin.year_end_procedures'));
$response->assertRedirect(route('dashboard')) $response->assertRedirect(route('dashboard'))
->with('success', 'Year end cleanup completed. '); ->with('success', 'Year end cleanup completed. ');
}); });

View File

@ -1,5 +1,6 @@
<?php <?php
use App\Models\Entry;
use App\Models\User; use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Foundation\Testing\RefreshDatabase;
@ -14,8 +15,183 @@ describe('index method', function () {
$response = $this->get(route('monitor.index')); $response = $this->get(route('monitor.index'));
$response->assertForbidden(); $response->assertForbidden();
}); });
it('needs additional tests written', function () {
// TODO: Write tests for new monitor pabe it('presents a form to choose an entry', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
actingAs($user);
$response = $this->get(route('monitor.index'));
$response->assertOk()
->assertViewIs('tabulation.choose_entry');
});
});
describe('method flagForm is a form to decide what type of flag to put on an entry', function () {
it('only allows those assigned to monitor to access this page', function () {
$user = User::factory()->create();
actingAs($user);
$response = $this->post(route('monitor.enterFlag'));
$response->assertStatus(403);
});
it('wont add flags to an entry in an audition with published seats', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$entry->audition->addFlag('seats_published');
$response = $this->post(route('monitor.enterFlag'), ['entry_id' => $entry->id]);
$response->assertRedirect(route('monitor.index'))
->assertSessionHas('error');
expect($response->getSession()->get('error'))->toBe('Cannot set flags while results are published');
});
it('wont add flags to an entry in an audition with published advancement', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$entry->audition->addFlag('advancement_published');
$response = $this->post(route('monitor.enterFlag'), ['entry_id' => $entry->id]);
$response->assertRedirect(route('monitor.index'))
->assertSessionHas('error');
expect($response->getSession()->get('error'))->toBe('Cannot set flags while results are published');
});
it('wont add flags to an entry in an audition with scores', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
DB::table('score_sheets')->insert([
'user_id' => $user->id,
'entry_id' => $entry->id,
'subscores' => json_encode([12, 3, 5]),
'seating_total' => 1,
'advancement_total' => 1,
]);
$response = $this->post(route('monitor.enterFlag'), ['entry_id' => $entry->id]);
$response->assertRedirect(route('monitor.index'))
->assertSessionHas('error');
expect($response->getSession()->get('error'))->toBe('That entry has existing scores');
});
it('displays a form to choose a flag for the entry', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$response = $this->post(route('monitor.enterFlag'), ['entry_id' => $entry->id]);
$response->assertOk()
->assertViewIs('monitor_entry_flag_form');
});
});
describe('method storeFlag stores the flag and returns to the select entry form', function () {
it('only allows those assigned to monitor to access this page', function () {
$user = User::factory()->create();
$entry = Entry::factory()->create();
actingAs($user);
$response = $this->post(route('monitor.storeFlag', $entry), ['flag' => 'no_show']);
$response->assertForbidden();
});
it('wont add flags to an entry in an audition with published seats', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$entry->audition->addFlag('seats_published');
$response = $this->post(route('monitor.storeFlag', $entry), ['flag' => 'no_show']);
$response->assertRedirect(route('monitor.index'))
->assertSessionHas('error');
expect($response->getSession()->get('error'))->toBe('Cannot set flags while results are published');
});
it('wont add flags to an entry in an audition with published advancement', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$entry->audition->addFlag('advancement_published');
$response = $this->post(route('monitor.storeFlag', $entry), ['flag' => 'no_show']);
$response->assertRedirect(route('monitor.index'))
->assertSessionHas('error');
expect($response->getSession()->get('error'))->toBe('Cannot set flags while results are published');
});
it('wont add flags to an entry in an audition with scores', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
DB::table('score_sheets')->insert([
'user_id' => $user->id,
'entry_id' => $entry->id,
'subscores' => json_encode([12, 3, 5]),
'seating_total' => 1,
'advancement_total' => 1,
]);
$response = $this->post(route('monitor.storeFlag', $entry), ['flag' => 'no_show']);
$response->assertRedirect(route('monitor.index'))
->assertSessionHas('error');
expect($response->getSession()->get('error'))->toBe('That entry has existing scores');
});
it('wont add a bogus flag', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$response = $this->post(route('monitor.storeFlag', $entry), ['action' => 'nonsense']);
$response->assertRedirect(route('monitor.index'))
->assertSessionHas('error');
expect($response->getSession()->get('error'))->toBe('Invalid action requested');
});
it('can add a failed-prelim tag to an entry', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$response = $this->post(route('monitor.storeFlag', $entry), ['action' => 'failed-prelim']);
$response->assertRedirect(route('monitor.index'));
$entry->refresh();
expect($entry->hasFlag('failed_prelim'))->toBeTrue();
});
it('can add a no-show tag to an entry', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$response = $this->post(route('monitor.storeFlag', $entry), ['action' => 'no-show']);
$response->assertRedirect(route('monitor.index'));
$entry->refresh();
expect($entry->hasFlag('no_show'))->toBeTrue();
});
it('can clear flags', function () {
$user = User::factory()->create();
$user->addFlag('monitor');
$user->refresh();
actingAs($user);
$entry = Entry::factory()->create();
$entry->addFlag('no_show');
$entry->refresh();
expect($entry->hasFlag('no_show'))->toBeTrue();
$response = $this->post(route('monitor.storeFlag', $entry), ['action' => 'clear']);
$response->assertRedirect(route('monitor.index'));
$entry->refresh();
expect($entry->hasFlag('no_show'))->toBeFalse();
});
}); });
});

View File

@ -2,11 +2,6 @@ import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin'; import laravel from 'laravel-vite-plugin';
export default defineConfig({ export default defineConfig({
server: {
cors: {
origin: /^https?:\/\/(?:(?:[^:]+\.)?localhost|auditionadmin\.test|127\.0\.0\.1|\[::1\])(?::\d+)?$/,
}
},
plugins: [ plugins: [
laravel({ laravel({
input: ['resources/css/app.css', 'resources/js/app.js'], input: ['resources/css/app.css', 'resources/js/app.js'],