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
+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;
}
}