fix teacher pages display between school years
Tests / PHPUnit (push) Failing after 1m12s

This commit is contained in:
root
2026-07-15 20:52:19 -04:00
parent 5f27dccd0f
commit 9de2ab2a9f
9 changed files with 106 additions and 53 deletions
+4 -8
View File
@@ -1673,14 +1673,10 @@ class StudentController extends BaseController
$students = [];
if (in_array($role, ['parent', 'parent_dashboard'], true)) {
$schoolYear = $this->currentSchoolYearName((string) ($this->schoolYear ?? ''));
$parentId = (int)(session()->get('user_id') ?? 0);
if ($parentId > 0) {
$students = $this->studentModel
->select('id, school_id, firstname, lastname')
->where('parent_id', $parentId)
->orderBy('lastname', 'ASC')
->orderBy('firstname', 'ASC')
->findAll();
if ($parentId > 0 && $schoolYear !== '') {
$students = $this->studentModel->getByParentAndYear($parentId, $schoolYear);
}
} elseif (in_array($role, ['teacher', 'teacher_assistant', 'teacher_dashboard'], true)) {
$schoolYear = $this->currentSchoolYearName((string) ($this->schoolYear ?? ''));
@@ -1706,7 +1702,7 @@ class StudentController extends BaseController
)), static fn($v) => $v > 0));
if (!empty($sectionIds)) {
$studentClassModel = new \App\Models\StudentClassModel();
$rows = $studentClassModel->getStudentsByClassSectionIds($sectionIds);
$rows = $studentClassModel->getStudentsByClassSectionIds($sectionIds, $schoolYear);
$unique = [];
foreach ($rows as $r) {
$sid = (int)($r['student_id'] ?? 0);