Files
2026-05-16 13:44:12 -04:00

24 lines
636 B
PHP
Executable File

<?php
namespace App\Services\Calculators;
use App\Interfaces\ScoreCalculatorInterface;
use App\Models\QuizModel;
class QuizCalculator implements ScoreCalculatorInterface
{
private $quizModel;
public function __construct(QuizModel $quizModel)
{
$this->quizModel = $quizModel;
}
public function calculate(int $studentId, string $semester, string $schoolYear, ?int $classSectionId = null): array
{
$average = $this->quizModel->getAverageQuizScore($studentId, $semester, $schoolYear, $classSectionId);
return ['quiz_avg' => $average !== null ? (float) $average : null];
}
}