update homework tracking

This commit is contained in:
root
2026-04-07 18:42:39 -04:00
parent 05dad52e10
commit 2611730ec6
6 changed files with 117 additions and 65 deletions
+10 -6
View File
@@ -297,12 +297,16 @@ class TeacherController extends BaseController
$schoolYear = $forYear ?: ((string)($this->schoolYear ?? 'Not Set'));
$teachers = $this->teacherModel->getTeachersAndTAs();
// Prefer class sections for the selected year, fallback to all if none
$classSections = $classSectionModel
->where('school_year', $schoolYear)
->orderBy('class_section_name', 'ASC')
->findAll();
if (empty($classSections)) {
// Prefer class sections for the selected year if the column exists, otherwise fallback to all.
if ($this->db->fieldExists('school_year', 'classSection')) {
$classSections = $classSectionModel
->where('school_year', $schoolYear)
->orderBy('class_section_name', 'ASC')
->findAll();
if (empty($classSections)) {
$classSections = $classSectionModel->orderBy('class_section_name', 'ASC')->findAll();
}
} else {
$classSections = $classSectionModel->orderBy('class_section_name', 'ASC')->findAll();
}