fix gitlab tests
This commit is contained in:
@@ -24,12 +24,13 @@ class PromotionEligibilityService
|
||||
private LevelProgressionService $progression,
|
||||
private PromotionStatusService $statusService,
|
||||
private PromotionAuditService $audit
|
||||
) {}
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Evaluate eligibility for a single student.
|
||||
*
|
||||
* @param int|null $userId actor id for audit
|
||||
* @param int|null $userId actor id for audit
|
||||
*/
|
||||
public function evaluateStudent(
|
||||
int $studentId,
|
||||
@@ -37,7 +38,7 @@ class PromotionEligibilityService
|
||||
?int $userId = null
|
||||
): ?StudentPromotionRecord {
|
||||
$student = Student::query()->find($studentId);
|
||||
if (! $student) {
|
||||
if (!$student) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,7 @@ class PromotionEligibilityService
|
||||
$summary = $this->emptySummary();
|
||||
foreach ($studentIds as $studentId) {
|
||||
$student = Student::query()->find($studentId);
|
||||
if (! $student) {
|
||||
if (!$student) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@@ -131,7 +132,7 @@ class PromotionEligibilityService
|
||||
$summary = $this->emptySummary();
|
||||
foreach ($studentIds as $studentId) {
|
||||
$student = Student::query()->find($studentId);
|
||||
if (! $student) {
|
||||
if (!$student) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
@@ -213,7 +214,7 @@ class PromotionEligibilityService
|
||||
->first();
|
||||
$isNew = $existing === null;
|
||||
|
||||
$record = $existing ?: new StudentPromotionRecord;
|
||||
$record = $existing ?: new StudentPromotionRecord();
|
||||
$record->fill([
|
||||
'student_id' => $studentId,
|
||||
'parent_id' => (int) ($student->parent_id ?? 0) ?: null,
|
||||
@@ -287,7 +288,7 @@ class PromotionEligibilityService
|
||||
->orderByDesc('id')
|
||||
->first();
|
||||
|
||||
if (! $decision) {
|
||||
if (!$decision) {
|
||||
return [
|
||||
'passed' => null,
|
||||
'final_average' => null,
|
||||
@@ -331,14 +332,14 @@ class PromotionEligibilityService
|
||||
return [
|
||||
'passed' => null,
|
||||
'final_average' => $score,
|
||||
'notes' => 'student_decisions has unrecognized decision: '.$rawDecision,
|
||||
'notes' => 'student_decisions has unrecognized decision: ' . $rawDecision,
|
||||
'has_data' => false,
|
||||
];
|
||||
}
|
||||
|
||||
private function resolveStatusFromEvaluation(?bool $passed, bool $terminal, bool $hasData): string
|
||||
{
|
||||
if (! $hasData) {
|
||||
if (!$hasData) {
|
||||
return StudentPromotionRecord::STATUS_ON_HOLD;
|
||||
}
|
||||
if ($passed === false) {
|
||||
@@ -347,7 +348,6 @@ class PromotionEligibilityService
|
||||
if ($terminal) {
|
||||
return StudentPromotionRecord::STATUS_GRADUATED;
|
||||
}
|
||||
|
||||
return StudentPromotionRecord::STATUS_AWAITING_PARENT;
|
||||
}
|
||||
|
||||
@@ -380,17 +380,15 @@ class PromotionEligibilityService
|
||||
private function resolveCurrentSchoolYear(): ?string
|
||||
{
|
||||
$year = (string) (Configuration::getConfigValueByKey('school_year') ?? '');
|
||||
|
||||
return $year !== '' ? $year : null;
|
||||
}
|
||||
|
||||
private function nextSchoolYear(string $current): ?string
|
||||
{
|
||||
if (! preg_match('/^(\d{4})-(\d{4})$/', $current, $m)) {
|
||||
if (!preg_match('/^(\d{4})-(\d{4})$/', $current, $m)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return ((int) $m[1] + 1).'-'.((int) $m[2] + 1);
|
||||
return ((int) $m[1] + 1) . '-' . ((int) $m[2] + 1);
|
||||
}
|
||||
|
||||
private function passThreshold(): float
|
||||
@@ -399,7 +397,6 @@ class PromotionEligibilityService
|
||||
if ($configured !== null && is_numeric($configured)) {
|
||||
return (float) $configured;
|
||||
}
|
||||
|
||||
return self::DEFAULT_PASS_THRESHOLD;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user