EntrySeeder update

# Conflicts:
#	database/seeders/EntrySeeder.php
This commit is contained in:
Matt Young 2025-06-10 23:35:21 -05:00
parent b6fd8fb71c
commit e785d33a2d
1 changed files with 48 additions and 41 deletions

View File

@ -17,80 +17,87 @@ class EntrySeeder extends Seeder
public function run(): void
{
$students = Student::all();
$hs_auditions = Audition::where('maximum_grade', '=', '12');
$freshman_auditions = Audition::where('maximum_grade', '>', '8');
$jh_auditions = Audition::where('maximum_grade', '=', '9');
$seventh_auditions = Audition::where('maximum_grade', '=', '7');
foreach ($students as $student) {
if ($student->grade > 9) {
$audition = Audition::where('maximum_grade', '=', '12')->inRandomOrder()->first();
$audition = Audition::where('maximum_grade', '=', '12')
->inRandomOrder()->first();
}
if ($student->grade == 9) {
$audition = Audition::where('maximum_grade', '>', '8')->inRandomOrder()->first();
$audition = Audition::where('maximum_grade', '>', '8')
->inRandomOrder()->first();
}
if ($student->grade == 8) {
$audition = Audition::where('maximum_grade', '=', '9')->inRandomOrder()->first();
$audition = Audition::where('maximum_grade', '=', '9')
->inRandomOrder()->first();
}
if ($student->grade == 7) {
$audition = Audition::where('maximum_grade', '=', '7')->inRandomOrder()->first();
$audition = Audition::where('maximum_grade', '=', '7')
->inRandomOrder()->first();
}
Entry::create([
'student_id' => $student->id,
'audition_id' => $audition->id,
'for_seating' => 1,
'for_advancement' => 1,
]);
if (mt_rand(1, 100) > 90) {
if ($student->grade > 9) {
$audition2 = Audition::where('maximum_grade', '=', '12')->where('id', '!=',
$audition->id)->inRandomOrder()->first();
$audition2 = Audition::where('maximum_grade', '=', '12')
->where('id', '!=', $audition->id)
->inRandomOrder()->first();
}
if ($student->grade == 9) {
$audition2 = Audition::where('maximum_grade', '>', '8')->where('id', '!=',
$audition->id)->inRandomOrder()->first();
$audition2 = Audition::where('maximum_grade', '>', '8')
->where('id', '!=', $audition->id)
->inRandomOrder()->first();
}
if ($student->grade == 8) {
$audition2 = Audition::where('maximum_grade', '=', '9')->where('id', '!=',
$audition->id)->inRandomOrder()->first();
$audition2 = Audition::where('maximum_grade', '=', '9')
->where('id', '!=', $audition->id)
->inRandomOrder()->first();
}
if ($student->grade == 7) {
$audition2 = Audition::where('maximum_grade', '=', '7')->where('id', '!=',
$audition->id)->inRandomOrder()->first();
$audition2 = Audition::where('maximum_grade', '=', '7')
->where('id', '!=', $audition->id)
->inRandomOrder()->first();
}
Entry::create([
'student_id' => $student->id,
'audition_id' => $audition2->id,
'for_seating' => 1,
'for_advancement' => 1,
]);
// Triplers are possible
if (mt_rand(1, 100) > 90) {
if ($student->grade > 9) {
$audition3 = Audition::where('maximum_grade', '=', '12')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
if ($student->grade == 9) {
$audition3 = Audition::where('maximum_grade', '>', '8')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
if ($student->grade == 8) {
$audition3 = Audition::where('maximum_grade', '=', '9')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
if ($student->grade == 7) {
$audition3 = Audition::where('maximum_grade', '=', '7')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
Entry::create([
'student_id' => $student->id,
'audition_id' => $audition3->id,
]);
}
}
if (mt_rand(1, 100) > 90) {
if ($student->grade > 9) {
$audition3 = Audition::where('maximum_grade', '=', '12')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
if ($student->grade == 9) {
$audition3 = Audition::where('maximum_grade', '>', '8')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
if ($student->grade == 8) {
$audition3 = Audition::where('maximum_grade', '=', '9')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
if ($student->grade == 7) {
$audition3 = Audition::where('maximum_grade', '=', '7')->where('id', '!=',
$audition->id)->where('id', '!=', $audition2->id)->inRandomOrder()->first();
}
Entry::create([
'student_id' => $student->id,
'audition_id' => $audition3->id,
'for_seating' => 1,
'for_advancement' => 1,
]);
}
}
}
}