fix school year and related issues
Tests / PHPUnit (push) Failing after 34s

This commit is contained in:
root
2026-07-30 00:48:54 -04:00
parent f8f00c70c8
commit 81a72a4c59
27 changed files with 1512 additions and 52 deletions
+19 -1
View File
@@ -8,6 +8,7 @@ use App\Models\UserModel;
use App\Models\AuthorizedUserModel;
use App\Models\RoleModel;
use App\Models\ParentModel;
use App\Models\ParentPolicyAcceptanceModel;
use App\Models\UserRoleModel;
use App\Services\EmailService;
use App\Services\SchoolIdService;
@@ -23,6 +24,7 @@ class RegisterController extends Controller
protected $roleModel;
protected $userModel;
protected $parentModel;
protected ParentPolicyAcceptanceModel $policyAcceptanceModel;
public function __construct()
{
@@ -40,6 +42,7 @@ class RegisterController extends Controller
$this->roleModel = new RoleModel();
$this->userModel = new UserModel();
$this->parentModel = new ParentModel();
$this->policyAcceptanceModel = new ParentPolicyAcceptanceModel();
$this->semester = $this->configModel->getConfig('semester');
$this->schoolYear = $this->configModel->getConfig('school_year');
@@ -119,7 +122,7 @@ class RegisterController extends Controller
'city' => 'required|alpha_space|min_length[2]|max_length[30]',
'state' => 'required|in_list[CT,ME,MA,NH,NY,RI,VT]',
'zip' => 'required|regex_match[/^\d{5}$/]',
'accept_school_policy' => 'required',
'accept_school_policy' => 'required|in_list[1]',
'captcha' => 'required|alpha_numeric|min_length[4]|max_length[10]',
];
@@ -221,6 +224,21 @@ class RegisterController extends Controller
'created_at' => utc_now(),
]);
if ($isParent && (int) $post['accept_school_policy'] === 1) {
$recordedPolicyAcceptance = $this->policyAcceptanceModel->recordAcceptance(
(int) $firstParentId,
(string) $this->schoolYear,
'new_parent_registration',
$this->request->getIPAddress(),
$this->request->getUserAgent()->getAgentString()
);
if (! $recordedPolicyAcceptance) {
$this->db->transRollback();
return redirect()->back()->withInput()->with('error', 'Unable to record school policy acceptance. Please try again.');
}
}
/* ───────────── 8. Optional second-parent insert ───────────── */
if ($isParent) {
if (empty($rawPost['no_second_parent_info'])) {