recreate project
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Calculators;
|
||||
|
||||
use App\Interfaces\ScoreCalculatorInterface;
|
||||
use App\Models\HomeworkModel;
|
||||
|
||||
class HomeworkCalculator implements ScoreCalculatorInterface
|
||||
{
|
||||
private $homeworkModel;
|
||||
|
||||
public function __construct(HomeworkModel $homeworkModel)
|
||||
{
|
||||
$this->homeworkModel = $homeworkModel;
|
||||
}
|
||||
|
||||
public function calculate(int $studentId, string $semester, string $schoolYear, ?int $classSectionId = null): array
|
||||
{
|
||||
$average = $this->homeworkModel->getAverageHomeworkScore($studentId, $semester, $schoolYear, $classSectionId);
|
||||
|
||||
return ['homework_avg' => $average !== null ? (float) $average : null];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user