apply the school year concept
Tests / PHPUnit (push) Failing after 1m19s

This commit is contained in:
root
2026-07-14 00:59:00 -04:00
parent 504c3bc9f9
commit feb1b29a32
73 changed files with 4288 additions and 620 deletions
+29
View File
@@ -77,6 +77,13 @@ class ConfigurationModel extends Model
public function getConfig($key)
{
$key = (string) $key;
if ($key === 'school_year') {
$activeSchoolYear = $this->activeSchoolYearName();
if ($activeSchoolYear !== null) {
return $activeSchoolYear;
}
}
if ($key === 'semester') {
try {
$semester = (new \App\Services\SemesterRangeService($this))->getSemesterForDate();
@@ -90,4 +97,26 @@ class ConfigurationModel extends Model
return $this->getConfigValueByKey($key);
}
private function activeSchoolYearName(): ?string
{
try {
if (! $this->db->tableExists('school_years')) {
return null;
}
$row = $this->db->table('school_years')
->select('name')
->where('status', 'active')
->orderBy('id', 'DESC')
->get(1)
->getRowArray();
$name = trim((string) ($row['name'] ?? ''));
return $name !== '' ? $name : null;
} catch (\Throwable) {
return null;
}
}
}