From 6ae90d757b1cb4a30e91de52261cdc747f555e2b Mon Sep 17 00:00:00 2001 From: root Date: Sun, 30 Aug 2026 22:27:05 -0400 Subject: [PATCH] fadd column to enrollment table --- app/Services/EnrollmentTransitionService.php | 12 ++--- .../enroll_withdraw/enrollment_withdrawal.php | 46 ++++++++++--------- .../EnrollmentTransitionServiceTest.php | 25 +++------- 3 files changed, 35 insertions(+), 48 deletions(-) diff --git a/app/Services/EnrollmentTransitionService.php b/app/Services/EnrollmentTransitionService.php index 8468484..0aa59f7 100644 --- a/app/Services/EnrollmentTransitionService.php +++ b/app/Services/EnrollmentTransitionService.php @@ -825,16 +825,12 @@ final class EnrollmentTransitionService private function firstEnrollmentPlacement(array $student, string $targetSchoolYear): array { $grade = $this->classBaseName((string) ($student['registration_grade'] ?? '')); - $targetClass = $grade !== '' ? $this->classByName($grade, $targetSchoolYear) : null; - $targetSection = is_array($targetClass) - ? $this->baseSectionForClass((int) ($targetClass['id'] ?? 0), $targetSchoolYear) - : null; return [ - 'assigned_grade_id' => $targetClass['id'] ?? null, - 'assigned_grade_name' => $targetClass['class_name'] ?? ($grade !== '' ? $grade : null), - 'assigned_class_section_id' => $targetSection['class_section_id'] ?? null, - 'placement_status' => $targetSection === null ? 'manual_class_required' : 'same_class_assigned', + 'assigned_grade_id' => null, + 'assigned_grade_name' => $grade !== '' ? $grade : null, + 'assigned_class_section_id' => null, + 'placement_status' => 'manual_class_required', 'flags' => [], ]; } diff --git a/app/Views/enroll_withdraw/enrollment_withdrawal.php b/app/Views/enroll_withdraw/enrollment_withdrawal.php index 694ac4b..562ddb3 100644 --- a/app/Views/enroll_withdraw/enrollment_withdrawal.php +++ b/app/Views/enroll_withdraw/enrollment_withdrawal.php @@ -35,16 +35,17 @@ - - + + - - - - - - + + + + + + + @@ -100,11 +101,14 @@ - - + + - - + + + - - - - - + + + + +
Registration DateParent/GuardianRegister DateParent Student Name School IDAgeNew StudentCurrent ClassActual StatusUpdate Enrollment StatusAssign ClassAgeNew StudentRegistered ClassCurrent ClassActual StatusUpdate StatusAssign Class
+ +
No students available.
No students available.
@@ -383,10 +387,10 @@ dom: "<'row mb-2'<'col-sm-6'l><'col-sm-6'f>>" + "t" + "<'row mt-2'<'col-sm-5'i><'col-sm-7'p>>", - // Disable sort/search on interactive columns (status select, assign select) - columnDefs: [ - { targets: [8, 9], orderable: false, searchable: false }, - { targets: [0, 1, 2, 3, 4, 5, 6, 7], render: function(data, type) { + // Disable sort/search on interactive columns (status select, assign select) + columnDefs: [ + { targets: [9, 10], orderable: false, searchable: false }, + { targets: [0, 1, 2, 3, 4, 5, 6, 7, 8], render: function(data, type) { if (type === 'filter' || type === 'sort' || type === 'type') { return stripHtml(data); } diff --git a/tests/app/Services/EnrollmentTransitionServiceTest.php b/tests/app/Services/EnrollmentTransitionServiceTest.php index aa4cb17..e23e4c1 100644 --- a/tests/app/Services/EnrollmentTransitionServiceTest.php +++ b/tests/app/Services/EnrollmentTransitionServiceTest.php @@ -62,24 +62,10 @@ final class EnrollmentTransitionServiceTest extends TestCase ])); } - public function testFirstEnrollmentPlacementUsesRegistrationGradeBaseSection(): void + public function testFirstEnrollmentPlacementKeepsRegistrationGradeAsReferenceOnly(): void { - $classBuilder = $this->builderReturning(['id' => 3, 'class_name' => '3']); - $classBuilder->method('where')->willReturnSelf(); - - $sectionBuilder = $this->builderReturning([ - 'class_section_id' => 30, - 'class_id' => 3, - 'class_section_name' => '3', - ]); - $sectionBuilder->method('where')->willReturnSelf(); - $db = $this->createMock(BaseConnection::class); - $db->method('tableExists')->willReturnCallback(static fn (string $table): bool => $table === 'classSection'); - $db->method('fieldExists')->willReturn(false); - $db->method('table')->willReturnCallback(static function (string $table) use ($classBuilder, $sectionBuilder) { - return $table === 'classes' ? $classBuilder : $sectionBuilder; - }); + $db->expects($this->never())->method('table'); $service = new EnrollmentTransitionService($db); @@ -88,9 +74,10 @@ final class EnrollmentTransitionServiceTest extends TestCase '2026-2027', ]); - $this->assertSame(3, (int) $placement['assigned_grade_id']); - $this->assertSame(30, (int) $placement['assigned_class_section_id']); - $this->assertSame('same_class_assigned', $placement['placement_status']); + $this->assertNull($placement['assigned_grade_id']); + $this->assertSame('3', $placement['assigned_grade_name']); + $this->assertNull($placement['assigned_class_section_id']); + $this->assertSame('manual_class_required', $placement['placement_status']); } public function testClassLookupFallsBackToGlobalRowsWhenSchoolYearSpecificRowIsMissing(): void