recreate project
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?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];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user