add projet
This commit is contained in:
Executable
+45
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SemesterScoreService
|
||||
{
|
||||
public function updateStudentScores(array $data, string $semester, string $schoolYear): void
|
||||
{
|
||||
Log::info('SemesterScoreService placeholder update', [
|
||||
'student_id' => $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(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user