$data['student_id'] ?? null, 'class_section_id' => $data['class_section_id'] ?? null, 'semester' => $semester, 'school_year' => $schoolYear, ]); // TODO: Implement actual score recalculation logic. } /** * Update scores for multiple students * @param array $studentInfo Array of student info arrays, each containing at least student_id and class_section_id */ public function updateScoresForStudents(array $studentInfo): void { if (empty($studentInfo)) { return; } foreach ($studentInfo as $student) { if (!isset($student['student_id']) || !isset($student['class_section_id'])) { continue; } try { $this->updateStudentScores($student, $student['semester'] ?? '', $student['school_year'] ?? ''); } catch (\Throwable $e) { Log::error('Failed to update scores for student', [ 'student_id' => $student['student_id'] ?? null, 'error' => $e->getMessage(), ]); } } } }