fix pages and add distribution system
Tests / PHPUnit (push) Failing after 1m13s

This commit is contained in:
root
2026-07-15 23:03:51 -04:00
parent 7f3b24e47f
commit ba87598d3a
38 changed files with 1362 additions and 658 deletions
+29 -2
View File
@@ -32,6 +32,12 @@ class StaffController extends BaseController
public function index()
{
if ($redirect = $this->redirectWithoutLegacyTermFilters('staff/index')) {
return $redirect;
}
$schoolYear = $this->currentSchoolYearName((string) ($this->schoolYear ?? ''));
// roles we never show
$excludedRoles = ['student', 'parent', 'guest', 'inactive']; // ← add inactive here
@@ -45,7 +51,7 @@ class StaffController extends BaseController
$assignRows = $this->teacherClassModel
->select('teacher_class.teacher_id, teacher_class.position, classSection.class_section_name')
->join('classSection', 'classSection.class_section_id = teacher_class.class_section_id', 'left')
->where('teacher_class.school_year', (string)$this->schoolYear)
->where('teacher_class.school_year', $schoolYear)
->findAll();
$assignByTeacher = [];
@@ -88,10 +94,31 @@ class StaffController extends BaseController
'staff' => $staffList,
'issues_count' => $issuesCount,
'semester' => $this->semester,
'school_year' => $this->schoolYear,
'school_year' => $schoolYear,
]);
}
private function redirectWithoutLegacyTermFilters(string $route): ?\CodeIgniter\HTTP\RedirectResponse
{
$legacyTermKeys = ['school_year', 'schoolYear', 'year', 'semester'];
$query = $this->request->getGet();
$hasLegacyTermFilter = false;
foreach ($legacyTermKeys as $key) {
if (array_key_exists($key, $query)) {
unset($query[$key]);
$hasLegacyTermFilter = true;
}
}
if (!$hasLegacyTermFilter) {
return null;
}
$target = site_url($route) . (!empty($query) ? '?' . http_build_query($query) : '');
return redirect()->to($target);
}
public function create()
{
return view('staff/create');