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
+9 -8
View File
@@ -49,14 +49,15 @@ switch ($role) {
try {
$studentModel = new \App\Models\StudentModel();
if (in_array($role, ['parent', 'parent_dashboard'], true)) {
$configModel = new \App\Models\ConfigurationModel();
try {
$schoolYear = service('schoolYearContext')->resolve(service('request'))->yearName();
} catch (\Throwable $e) {
$schoolYear = session()->get('school_year') ?? $configModel->getConfig('school_year');
}
$parentId = (int)(session()->get('user_id') ?? 0);
if ($parentId > 0) {
$scoreCardStudents = $studentModel
->select('id, school_id, firstname, lastname')
->where('parent_id', $parentId)
->orderBy('lastname', 'ASC')
->orderBy('firstname', 'ASC')
->findAll();
if ($parentId > 0 && !empty($schoolYear)) {
$scoreCardStudents = $studentModel->getByParentAndYear($parentId, (string) $schoolYear);
}
} else {
$configModel = new \App\Models\ConfigurationModel();
@@ -85,7 +86,7 @@ switch ($role) {
)), static fn($v) => $v > 0));
if (!empty($sectionIds)) {
$studentClassModel = new \App\Models\StudentClassModel();
$rows = $studentClassModel->getStudentsByClassSectionIds($sectionIds);
$rows = $studentClassModel->getStudentsByClassSectionIds($sectionIds, (string) $schoolYear);
$unique = [];
foreach ($rows as $r) {
$sid = (int)($r['student_id'] ?? 0);