add tests batch 20

This commit is contained in:
root
2026-06-09 01:03:53 -04:00
parent 95efb9652e
commit 6be4875c5e
1502 changed files with 13797 additions and 11313 deletions
@@ -6,7 +6,9 @@ use App\Models\Incident;
class IncidentAnalysisService
{
public function __construct(private IncidentLookupService $lookup) {}
public function __construct(private IncidentLookupService $lookup)
{
}
public function analyze(?string $schoolYear, ?string $semester): array
{
@@ -29,7 +31,7 @@ class IncidentAnalysisService
foreach ($incidents as $incident) {
$studentId = (string) ($incident['student_id'] ?? '');
$studentName = (string) ($incident['student_name'] ?? '');
$studentKey = $studentId !== '' ? 'id:'.$studentId : 'name:'.strtolower(trim($studentName));
$studentKey = $studentId !== '' ? 'id:' . $studentId : 'name:' . strtolower(trim($studentName));
$gradeValue = $incident['grade'] ?? '';
$gradeLabel = $gradeValue;
@@ -37,7 +39,7 @@ class IncidentAnalysisService
$gradeLabel = $gradeMap[(int) $gradeValue] ?? (string) $gradeValue;
}
if (! isset($students[$studentKey])) {
if (!isset($students[$studentKey])) {
$students[$studentKey] = [
'student_id' => $studentId,
'student_name' => $studentName,
@@ -82,7 +84,6 @@ class IncidentAnalysisService
if ($a['total'] === $b['total']) {
return strcasecmp($a['student_name'], $b['student_name']);
}
return $b['total'] <=> $a['total'];
});