fix is_new issue with enrollment fixes
This commit is contained in:
@@ -58,7 +58,7 @@ public function buildRoster(string $selectedYear, string $semester): array
|
||||
$students = $this->studentModel->getStudentsWithClassAndEnrollment($selectedYear);
|
||||
|
||||
$removedPriorStatuses = $this->removedPriorYearStudentStatuses($selectedYear);
|
||||
$returningStudentIds = $this->priorYearStudentIds($selectedYear);
|
||||
service('studentYearStatus')->attachToStudents($students, $selectedYear);
|
||||
|
||||
foreach ($students as &$s) {
|
||||
// ===== Ensure IDs needed by the modal =====
|
||||
@@ -93,11 +93,8 @@ public function buildRoster(string $selectedYear, string $semester): array
|
||||
$s['parent_sort'] = 'ZZZ Unknown Parent';
|
||||
}
|
||||
|
||||
// ===== New-student flags =====
|
||||
$s['is_new'] = (int) ($s['is_new'] ?? 0);
|
||||
if (isset($returningStudentIds[$s['student_id']])) {
|
||||
$s['is_new'] = 0;
|
||||
}
|
||||
// ===== New-student flags (year-scoped) =====
|
||||
$s['is_new'] = (int) ($s['is_new'] ?? 1) === 1 ? 1 : 0;
|
||||
$s['new_student'] = $s['is_new'] === 1 ? 'Yes' : 'No';
|
||||
|
||||
// ===== Admission override =====
|
||||
@@ -158,7 +155,7 @@ public function buildRoster(string $selectedYear, string $semester): array
|
||||
*/
|
||||
public function newStudents(string $schoolYear): array
|
||||
{
|
||||
$rows = $this->studentModel->getStudentsWithParentsAndEmergency($schoolYear);
|
||||
$rows = $this->studentModel->getStudentsWithParentsAndEmergency($schoolYear, 1);
|
||||
|
||||
$newStudents = [];
|
||||
foreach ($rows as $r) {
|
||||
@@ -170,7 +167,7 @@ public function newStudents(string $schoolYear): array
|
||||
? $classSection
|
||||
: 'Class not Assigned';
|
||||
|
||||
$r['is_new'] = (int) $r['is_new'];
|
||||
$r['is_new'] = (int) ($r['is_new'] ?? 1) === 1 ? 1 : 0;
|
||||
$r['new_student'] = $r['is_new'] === 1 ? "Yes" : "No";
|
||||
$r['modalIdContact'] = 'contact_' . (int)($r['id'] ?? 0);
|
||||
$r['enrollment_status'] = $enrollmentstatus;
|
||||
|
||||
Reference in New Issue
Block a user