fix parent and teacher pages to follow year filter
Tests / PHPUnit (push) Failing after 1m15s

This commit is contained in:
root
2026-07-15 20:03:36 -04:00
parent feb1b29a32
commit 5f27dccd0f
32 changed files with 582 additions and 364 deletions
+8 -1
View File
@@ -29,6 +29,7 @@ class ParentProgressController extends BaseController
public function index()
{
$schoolYear = $this->currentSchoolYearName();
$students = $this->getParentStudents();
$sectionIds = array_values(array_unique(array_filter(array_map(
static fn (array $student): int => (int) ($student['class_section_id'] ?? 0),
@@ -42,7 +43,8 @@ class ParentProgressController extends BaseController
->select('class_progress_reports.*, cs.class_section_name, CONCAT(IFNULL(u.firstname, ""), " ", IFNULL(u.lastname, "")) AS teacher_name')
->join('classSection cs', 'cs.class_section_id = class_progress_reports.class_section_id', 'left')
->join('users u', 'u.id = class_progress_reports.teacher_id', 'left')
->whereIn('class_progress_reports.class_section_id', $sectionIds);
->whereIn('class_progress_reports.class_section_id', $sectionIds)
->where('class_progress_reports.school_year', $schoolYear);
$rows = $builder
->orderBy('week_start', 'DESC')
@@ -75,10 +77,12 @@ class ParentProgressController extends BaseController
public function view($id)
{
$schoolYear = $this->currentSchoolYearName();
$row = $this->reportModel
->select('class_progress_reports.*, cs.class_section_name, CONCAT(IFNULL(u.firstname, ""), " ", IFNULL(u.lastname, "")) AS teacher_name')
->join('classSection cs', 'cs.class_section_id = class_progress_reports.class_section_id', 'left')
->join('users u', 'u.id = class_progress_reports.teacher_id', 'left')
->where('class_progress_reports.school_year', $schoolYear)
->find((int) $id);
if (! $row || ! $this->isSectionAccessible($row['class_section_id'] ?? null)) {
@@ -92,6 +96,7 @@ class ParentProgressController extends BaseController
->select('class_progress_reports.*')
->where('class_section_id', $row['class_section_id'])
->where('week_start', $row['week_start'])
->where('school_year', $schoolYear)
->orderBy('subject', 'ASC')
->findAll();
@@ -165,6 +170,7 @@ class ParentProgressController extends BaseController
$rows = $this->enrollmentModel
->select('class_section_id')
->where('parent_id', $parentId)
->where('school_year', $this->currentSchoolYearName())
->where('is_withdrawn', 0)
->groupBy('class_section_id')
->findAll();
@@ -213,6 +219,7 @@ class ParentProgressController extends BaseController
->join('students s', 's.id = e.student_id')
->join('classSection cs', 'cs.class_section_id = e.class_section_id', 'left')
->where('e.parent_id', $parentId)
->where('e.school_year', $this->currentSchoolYearName())
->where('e.is_withdrawn', 0)
->orderBy('e.updated_at', 'DESC')
->orderBy('e.created_at', 'DESC')