update policy and fix other issues
Deploy to Shared Hosting / Shared hosting deploy (push) Failing after 49s
Tests / PHPUnit (push) Successful in 1m19s

This commit is contained in:
root
2026-08-23 18:19:08 -04:00
parent 103f970110
commit a6e0ce1432
13 changed files with 433 additions and 317 deletions
+9 -3
View File
@@ -1200,7 +1200,10 @@ class InventoryController extends BaseController
->where('ur.user_id', $user_id)
->get()->getResultArray();
$roleNames = array_map(fn($r) => $r['name'], $roles);
$roleNames = array_map(
static fn($r): string => strtolower(trim((string) ($r['name'] ?? ''))),
$roles
);
if (in_array('teacher', $roleNames, true)) {
$user['role_name'] = 'teacher';
@@ -1211,12 +1214,15 @@ class InventoryController extends BaseController
}
// 4) Collect class_section IDs
$classSectionIds = array_column($classes, 'class_section_id');
$classSectionIds = array_values(array_filter(array_map(
static fn($class): int => (int) ($class['class_section_id'] ?? 0),
$classes
)));
$studentsData = [];
// 5) Group students by class_section_id
if (!empty($classSectionIds)) {
$students = $this->studentClassModel->getStudentsByClassSectionIds($classSectionIds);
$students = $this->studentClassModel->getStudentsByClassSectionIds($classSectionIds, $this->schoolYear);
foreach ($students as $student) {
$studentsData[$student['class_section_id']][] = $student;
}