fix parent, teacher and admin pages
This commit is contained in:
@@ -41,6 +41,7 @@ class TeacherDashboardService
|
||||
'students' => [],
|
||||
'studentsBySection' => [],
|
||||
'active_class_section_id' => null,
|
||||
'class_section_name' => null,
|
||||
'assignedNames' => [],
|
||||
];
|
||||
}
|
||||
@@ -118,12 +119,24 @@ class TeacherDashboardService
|
||||
|
||||
$teacher = User::query()->find($userId)?->toArray();
|
||||
|
||||
$classSectionName = null;
|
||||
if ($activeClassSectionId !== null && (int) $activeClassSectionId > 0) {
|
||||
foreach ($classes as $row) {
|
||||
if ((int) ($row['class_section_id'] ?? 0) === (int) $activeClassSectionId) {
|
||||
$n = trim((string) ($row['class_section_name'] ?? ''));
|
||||
$classSectionName = $n !== '' ? $n : null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'teacher' => $teacher,
|
||||
'classes' => $classes,
|
||||
'students' => $activeClassSectionId ? ($studentsBySection[$activeClassSectionId] ?? []) : [],
|
||||
'studentsBySection' => $studentsBySection,
|
||||
'active_class_section_id' => $activeClassSectionId,
|
||||
'class_section_name' => $classSectionName,
|
||||
'assignedNames' => $assignedNames,
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user