Fixed many feature failures around preferences, route coverage, administrator enrollment, assignment section names, attendance tracking controller access, finance PDF generation, and finance notification logging.
API CI/CD / Validate (composer + pint) (push) Successful in 3m15s
API CI/CD / Test (PHPUnit) (push) Failing after 5m4s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
API CI/CD / Validate (composer + pint) (push) Successful in 3m15s
API CI/CD / Test (PHPUnit) (push) Failing after 5m4s
API CI/CD / Build frontend assets (push) Successful in 1m3s
API CI/CD / Security audit (push) Failing after 49s
API CI/CD / Deploy to shared hosting (PHP) (push) Has been skipped
This commit is contained in:
@@ -14,15 +14,41 @@ class AssignmentSectionService
|
||||
return [];
|
||||
}
|
||||
|
||||
return $this->classSection
|
||||
$map = [];
|
||||
|
||||
$this->classSection
|
||||
->newQuery()
|
||||
->whereIn('class_section_id', $sectionIds)
|
||||
->get()
|
||||
->mapWithKeys(function ($section) {
|
||||
$name = $section->class_section_name ?? $section->section_name ?? $section->name ?? '';
|
||||
->each(function ($section) use (&$map) {
|
||||
$map[(int) $section->class_section_id] = $this->sectionName($section);
|
||||
});
|
||||
|
||||
return [(int) $section->class_section_id => (string) $name];
|
||||
})
|
||||
$missing = collect($sectionIds)
|
||||
->map(fn ($id) => (int) $id)
|
||||
->reject(fn ($id) => array_key_exists($id, $map))
|
||||
->values()
|
||||
->all();
|
||||
|
||||
if (! empty($missing)) {
|
||||
$this->classSection
|
||||
->newQuery()
|
||||
->whereIn('id', $missing)
|
||||
->get()
|
||||
->each(function ($section) use (&$map) {
|
||||
$map[(int) $section->id] = $this->sectionName($section);
|
||||
});
|
||||
}
|
||||
|
||||
return $map;
|
||||
}
|
||||
|
||||
private function sectionName(ClassSection $section): string
|
||||
{
|
||||
return (string) (collect([
|
||||
$section->class_section_name ?? null,
|
||||
$section->section_name ?? null,
|
||||
$section->name ?? null,
|
||||
])->first(fn ($value) => trim((string) $value) !== '') ?? '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user