fadd column to enrollment table
This commit is contained in:
@@ -825,16 +825,12 @@ final class EnrollmentTransitionService
|
|||||||
private function firstEnrollmentPlacement(array $student, string $targetSchoolYear): array
|
private function firstEnrollmentPlacement(array $student, string $targetSchoolYear): array
|
||||||
{
|
{
|
||||||
$grade = $this->classBaseName((string) ($student['registration_grade'] ?? ''));
|
$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 [
|
return [
|
||||||
'assigned_grade_id' => $targetClass['id'] ?? null,
|
'assigned_grade_id' => null,
|
||||||
'assigned_grade_name' => $targetClass['class_name'] ?? ($grade !== '' ? $grade : null),
|
'assigned_grade_name' => $grade !== '' ? $grade : null,
|
||||||
'assigned_class_section_id' => $targetSection['class_section_id'] ?? null,
|
'assigned_class_section_id' => null,
|
||||||
'placement_status' => $targetSection === null ? 'manual_class_required' : 'same_class_assigned',
|
'placement_status' => 'manual_class_required',
|
||||||
'flags' => [],
|
'flags' => [],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,16 +35,17 @@
|
|||||||
<table id="enrollmentTable" class="table table-bordered table-striped mt-4 align-middle">
|
<table id="enrollmentTable" class="table table-bordered table-striped mt-4 align-middle">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Registration Date</th>
|
<th>Register Date</th>
|
||||||
<th>Parent/Guardian</th>
|
<th>Parent</th>
|
||||||
<th>Student Name</th>
|
<th>Student Name</th>
|
||||||
<th>School ID</th>
|
<th>School ID</th>
|
||||||
<th>Age</th>
|
<th>Age</th>
|
||||||
<th>New Student</th>
|
<th>New Student</th>
|
||||||
<th>Current Class</th>
|
<th>Registered Class</th>
|
||||||
<th>Actual Status</th>
|
<th>Current Class</th>
|
||||||
<th>Update Enrollment Status</th>
|
<th>Actual Status</th>
|
||||||
<th>Assign Class</th>
|
<th>Update Status</th>
|
||||||
|
<th>Assign Class</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -100,11 +101,14 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<!-- Class -->
|
<!-- Registered Class -->
|
||||||
<td><?= esc($student['class_section'] ?? 'Class not Assigned') ?></td>
|
<td><?= esc(trim((string)($student['registration_grade'] ?? '')) !== '' ? (string)$student['registration_grade'] : '-') ?></td>
|
||||||
|
|
||||||
<!-- Enrollment Status -->
|
<!-- Class -->
|
||||||
<td>
|
<td><?= esc($student['class_section'] ?? 'Class not Assigned') ?></td>
|
||||||
|
|
||||||
|
<!-- Enrollment Status -->
|
||||||
|
<td>
|
||||||
<?php
|
<?php
|
||||||
$status = $student['enrollment_status'] ?? 'not enrolled';
|
$status = $student['enrollment_status'] ?? 'not enrolled';
|
||||||
switch ($status) {
|
switch ($status) {
|
||||||
@@ -185,11 +189,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="10">No students available.</td>
|
<td colspan="11">No students available.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
@@ -383,10 +387,10 @@
|
|||||||
dom: "<'row mb-2'<'col-sm-6'l><'col-sm-6'f>>" + "t" +
|
dom: "<'row mb-2'<'col-sm-6'l><'col-sm-6'f>>" + "t" +
|
||||||
"<'row mt-2'<'col-sm-5'i><'col-sm-7'p>>",
|
"<'row mt-2'<'col-sm-5'i><'col-sm-7'p>>",
|
||||||
|
|
||||||
// Disable sort/search on interactive columns (status select, assign select)
|
// Disable sort/search on interactive columns (status select, assign select)
|
||||||
columnDefs: [
|
columnDefs: [
|
||||||
{ targets: [8, 9], orderable: false, searchable: false },
|
{ targets: [9, 10], orderable: false, searchable: false },
|
||||||
{ targets: [0, 1, 2, 3, 4, 5, 6, 7], render: function(data, type) {
|
{ targets: [0, 1, 2, 3, 4, 5, 6, 7, 8], render: function(data, type) {
|
||||||
if (type === 'filter' || type === 'sort' || type === 'type') {
|
if (type === 'filter' || type === 'sort' || type === 'type') {
|
||||||
return stripHtml(data);
|
return stripHtml(data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 = $this->createMock(BaseConnection::class);
|
||||||
$db->method('tableExists')->willReturnCallback(static fn (string $table): bool => $table === 'classSection');
|
$db->expects($this->never())->method('table');
|
||||||
$db->method('fieldExists')->willReturn(false);
|
|
||||||
$db->method('table')->willReturnCallback(static function (string $table) use ($classBuilder, $sectionBuilder) {
|
|
||||||
return $table === 'classes' ? $classBuilder : $sectionBuilder;
|
|
||||||
});
|
|
||||||
|
|
||||||
$service = new EnrollmentTransitionService($db);
|
$service = new EnrollmentTransitionService($db);
|
||||||
|
|
||||||
@@ -88,9 +74,10 @@ final class EnrollmentTransitionServiceTest extends TestCase
|
|||||||
'2026-2027',
|
'2026-2027',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->assertSame(3, (int) $placement['assigned_grade_id']);
|
$this->assertNull($placement['assigned_grade_id']);
|
||||||
$this->assertSame(30, (int) $placement['assigned_class_section_id']);
|
$this->assertSame('3', $placement['assigned_grade_name']);
|
||||||
$this->assertSame('same_class_assigned', $placement['placement_status']);
|
$this->assertNull($placement['assigned_class_section_id']);
|
||||||
|
$this->assertSame('manual_class_required', $placement['placement_status']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testClassLookupFallsBackToGlobalRowsWhenSchoolYearSpecificRowIsMissing(): void
|
public function testClassLookupFallsBackToGlobalRowsWhenSchoolYearSpecificRowIsMissing(): void
|
||||||
|
|||||||
Reference in New Issue
Block a user