This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user