fix enrollment for the new school-year
Tests / PHPUnit (push) Successful in 1m26s

This commit is contained in:
root
2026-08-07 23:43:31 -04:00
parent b6f3b14e7b
commit 1ef2800f12
66 changed files with 8997 additions and 498 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class EnrollmentAgeRuleModel extends Model
{
protected $table = 'enrollment_age_rules';
protected $primaryKey = 'id';
protected $returnType = 'array';
protected $useTimestamps = true;
protected $allowedFields = [
'school_year',
'campus',
'grade_class_id',
'education_level',
'minimum_age',
'maximum_age',
'age_reference_date',
'behavior',
'exceptions_allowed',
'exception_roles',
'created_at',
'updated_at',
];
}
+32
View File
@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class EnrollmentEmailRecordModel extends Model
{
protected $table = 'enrollment_email_records';
protected $primaryKey = 'id';
protected $returnType = 'array';
protected $useTimestamps = true;
protected $allowedFields = [
'school_year',
'school_year_id',
'family_account_id',
'parent_user_id',
'recipient_addresses_json',
'template_version',
'generated_subject',
'generated_body',
'student_ids_included_json',
'generated_at',
'sent_at',
'delivery_status',
'failure_reason',
'retry_count',
'created_at',
'updated_at',
];
}
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class EnrollmentFlagModel extends Model
{
protected $table = 'enrollment_flags';
protected $primaryKey = 'id';
protected $returnType = 'array';
protected $useTimestamps = false;
protected $allowedFields = [
'flag_type',
'student_id',
'school_year',
'source_school_year',
'status',
'priority',
'assigned_to',
'details_json',
'created_at',
'resolved_at',
'resolution_notes',
];
}
+31 -2
View File
@@ -17,6 +17,22 @@ class EnrollmentModel extends Model
'class_section_id',
'parent_id',
'school_year',
'source_school_year',
'deliberation_decision',
'source_grade_id',
'assigned_grade_id',
'source_class_section_id',
'assigned_class_section_id',
'placement_status',
'age_reference_date',
'age_on_reference_date',
'adult_student',
'parent_enrollment_allowed',
'student_self_enrollment_allowed',
'exception_required',
'exception_reason',
'registration_submitted_at',
'registration_confirmed_at',
'enrollment_date',
'enrollment_status',
'withdrawal_date',
@@ -36,10 +52,23 @@ class EnrollmentModel extends Model
'class_section_id' => 'permit_empty|integer',
'parent_id' => 'required|integer',
'school_year' => 'required|string|max_length[9]',
'source_school_year' => 'permit_empty|string|max_length[20]',
'deliberation_decision' => 'permit_empty|in_list[PASSED,REPEAT_CLASS,MAKE_UP_EXAM,EXPELLED,WITHDRAWN,DEFERRED_DECISION]',
'source_grade_id' => 'permit_empty|integer',
'assigned_grade_id' => 'permit_empty|integer',
'source_class_section_id' => 'permit_empty|integer',
'assigned_class_section_id' => 'permit_empty|integer',
'placement_status' => 'permit_empty|string|max_length[40]',
'age_reference_date' => 'permit_empty|valid_date',
'age_on_reference_date' => 'permit_empty|integer',
'adult_student' => 'permit_empty|in_list[0,1]',
'parent_enrollment_allowed' => 'permit_empty|in_list[0,1]',
'student_self_enrollment_allowed' => 'permit_empty|in_list[0,1]',
'exception_required' => 'permit_empty|in_list[0,1]',
'enrollment_date' => 'required|valid_date',
'withdrawal_date' => 'permit_empty|valid_date',
'is_withdrawn' => 'permit_empty|in_list[0,1]',
'enrollment_status' => 'required|in_list[admission under review,payment pending,enrolled,withdraw under review,refund pending,withdrawn]',
'enrollment_status' => 'required|in_list[admission under review,review & decision,payment pending,enrolled,withdraw under review,refund pending,withdrawn,waitlist,denied]',
'admission_status' => 'required|in_list[pending,accepted,denied]',
'semester' => 'permit_empty|string|max_length[25]',
];
@@ -73,7 +102,7 @@ class EnrollmentModel extends Model
],
'enrollment_status' => [
'required' => 'Enrollment status is required',
'in_list' => 'Enrollment status must be one of: admission under review, payment pending, enrolled, withdraw under review, refund pending, withdrawn',
'in_list' => 'Enrollment status must be one of: admission under review, review & decision, payment pending, enrolled, withdraw under review, refund pending, withdrawn, waitlist, denied',
],
'admission_status' => [
'required' => 'Admission status is required',
@@ -0,0 +1,25 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class EnrollmentTransitionAuditModel extends Model
{
protected $table = 'enrollment_transition_audits';
protected $primaryKey = 'id';
protected $returnType = 'array';
protected $useTimestamps = false;
protected $allowedFields = [
'student_id',
'school_year',
'source_school_year',
'action',
'performed_by',
'original_values_json',
'new_values_json',
'reason',
'created_at',
];
}
+27
View File
@@ -19,6 +19,21 @@ class SchoolYearModel extends Model
'description',
'registration_starts_on',
'registration_ends_on',
'registration_opens_at',
'registration_deadline_at',
'late_registration_blocked',
'administrative_exceptions_permitted',
'registration_exception_roles',
'adult_student_registration_enabled',
'registration_fee',
'tuition_due_at_registration',
'mandatory_fees',
'carry_over_balance_behavior',
'financial_policy_message',
'payment_plan_available',
'registration_launch_approved_at',
'registration_launch_approved_by',
'registration_email_template_version',
'fall_makeup_exam_on',
'previous_school_year_id',
'next_school_year_id',
@@ -37,6 +52,18 @@ class SchoolYearModel extends Model
'ends_on' => 'permit_empty|valid_date[Y-m-d]',
'registration_starts_on' => 'permit_empty|valid_date[Y-m-d]',
'registration_ends_on' => 'permit_empty|valid_date[Y-m-d]',
'registration_opens_at' => 'permit_empty|valid_date[Y-m-d H:i:s]',
'registration_deadline_at' => 'permit_empty|valid_date[Y-m-d H:i:s]',
'late_registration_blocked' => 'permit_empty|in_list[0,1]',
'administrative_exceptions_permitted' => 'permit_empty|in_list[0,1]',
'adult_student_registration_enabled' => 'permit_empty|in_list[0,1]',
'registration_fee' => 'permit_empty|decimal',
'tuition_due_at_registration' => 'permit_empty|decimal',
'mandatory_fees' => 'permit_empty|decimal',
'carry_over_balance_behavior' => 'permit_empty|in_list[information_only,payment_plan_required,submission_allowed_confirmation_blocked,submission_blocked_until_payment,admin_approval_required]',
'payment_plan_available' => 'permit_empty|in_list[0,1]',
'registration_launch_approved_at' => 'permit_empty|valid_date[Y-m-d H:i:s]',
'registration_launch_approved_by' => 'permit_empty|integer',
'fall_makeup_exam_on' => 'permit_empty|valid_date[Y-m-d]',
];
+16
View File
@@ -4,6 +4,7 @@ namespace App\Models;
use CodeIgniter\Model;
use App\Models\Concerns\SchoolYearAutoFillTrait;
use App\Support\Enrollment\DeliberationDecision;
class StudentDecisionModel extends Model
{
@@ -18,6 +19,7 @@ class StudentDecisionModel extends Model
'class_section_name',
'year_score',
'decision',
'deliberation_decision_standard',
'source',
'notes',
'generated_by',
@@ -30,4 +32,18 @@ class StudentDecisionModel extends Model
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $beforeInsert = ['standardizeDeliberationDecision'];
protected $beforeUpdate = ['standardizeDeliberationDecision'];
protected function standardizeDeliberationDecision(array $data): array
{
if (
array_key_exists('decision', $data['data'] ?? [])
&& $this->db->fieldExists('deliberation_decision_standard', $this->table)
) {
$data['data']['deliberation_decision_standard'] = DeliberationDecision::normalize($data['data']['decision'] ?? null);
}
return $data;
}
}