fix enrollment logic, add financial aid, fix class distribution
Tests / PHPUnit (push) Failing after 1m6s
Tests / PHPUnit (push) Failing after 1m6s
This commit is contained in:
@@ -9,9 +9,10 @@ final class OldTuitionCalculatorService implements TuitionCalculatorInterface
|
||||
public function calculateFamilyTuition(array $students, array $config): array
|
||||
{
|
||||
$gradeFee = (int) ($config['grade_fee'] ?? 9);
|
||||
$firstStudentFee = $this->toCents($config['first_student_fee'] ?? 370);
|
||||
$secondStudentFee = $this->toCents($config['second_student_fee'] ?? 200);
|
||||
$youthFee = $this->toCents($config['youth_fee'] ?? 200);
|
||||
$firstStudentFee = $this->toCents($config['first_student_fee'] ?? $config['new_tuition_full_amount'] ?? 380);
|
||||
$secondStudentFee = isset($config['second_student_fee']) && $config['second_student_fee'] !== '' && $config['second_student_fee'] !== null
|
||||
? $this->toCents($config['second_student_fee'])
|
||||
: max(0, $firstStudentFee - 10000);
|
||||
|
||||
usort($students, function (array $left, array $right) use ($gradeFee): int {
|
||||
$leftLevel = GradeLevelParser::parse($left['grade_level'] ?? null, $gradeFee);
|
||||
@@ -20,20 +21,13 @@ final class OldTuitionCalculatorService implements TuitionCalculatorInterface
|
||||
return [$leftLevel, (int) ($left['student_id'] ?? 0)] <=> [$rightLevel, (int) ($right['student_id'] ?? 0)];
|
||||
});
|
||||
|
||||
$regularCount = 0;
|
||||
$familyPosition = 0;
|
||||
$details = [];
|
||||
|
||||
foreach ($students as $student) {
|
||||
$level = GradeLevelParser::parse($student['grade_level'] ?? null, $gradeFee);
|
||||
|
||||
if ($level > $gradeFee) {
|
||||
$amountCents = $youthFee;
|
||||
$rule = 'old_youth_fee';
|
||||
} else {
|
||||
$regularCount++;
|
||||
$amountCents = $regularCount === 1 ? $firstStudentFee : $secondStudentFee;
|
||||
$rule = $regularCount === 1 ? 'old_first_student_fee' : 'old_second_student_fee';
|
||||
}
|
||||
$familyPosition++;
|
||||
$amountCents = $familyPosition === 1 ? $firstStudentFee : $secondStudentFee;
|
||||
$rule = $familyPosition === 1 ? 'old_first_student_fee' : 'old_additional_student_fee';
|
||||
|
||||
$details[] = [
|
||||
'student_id' => (int) ($student['student_id'] ?? 0),
|
||||
|
||||
Reference in New Issue
Block a user