Skip to content

Timetable: fix course edit page missing parameter and columns#2085

Open
brianp-matrix wants to merge 2 commits into
GibbonEdu:v31.0.00from
brianp-matrix:fix/course-manage-edit-missing-params
Open

Timetable: fix course edit page missing parameter and columns#2085
brianp-matrix wants to merge 2 commits into
GibbonEdu:v31.0.00from
brianp-matrix:fix/course-manage-edit-missing-params

Conversation

@brianp-matrix
Copy link
Copy Markdown

@brianp-matrix brianp-matrix commented Apr 8, 2026

Summary

  • course_manage_edit.php line 143 called selectClassesByCourseID() with only 1 argument, but the method requires 2 ($gibbonCourseID, $gibbonSchoolYearID), causing an ArgumentCountError
  • The query in CourseGateway::selectClassesByCourseID() also only returned gibbonCourseClassID, course, and class — missing the columns needed by the DataTable: teachersTotal, studentsActive, studentsExpected, studentsTotal, name, reportable, enrolmentMin, enrolmentMax
  • Updated the query to LEFT JOIN gibbonCourseClassPerson and gibbonPerson with COUNT aggregations to provide all required columns

Test plan

  • Navigate to Timetable Admin > Manage Courses > Edit any course
  • Verify the page loads without errors
  • Verify the classes table shows teacher count, active/expected/total student counts
  • Verify under/over enrolled tags appear correctly based on enrolment min/max

selectClassesByCourseID() requires gibbonSchoolYearID but
course_manage_edit.php only passed gibbonCourseID, causing an
ArgumentCountError.

Also updated the query to return participant counts (teachersTotal,
studentsActive, studentsExpected, studentsTotal) and class metadata
(name, reportable, enrolmentMin, enrolmentMax) needed by the DataTable
columns on the edit page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Member

@SKuipers SKuipers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @brianp-matrix, thanks for your PR. I can appreciate that this may have appeared to be a bug. In looking closer at the code, the line $classes = $courseClassGateway->selectClassesByCourseID($gibbonCourseID); is correct, since the courseClassGateway does have a selectClassesByCourseID($gibbonCourseID) method.

The misunderstanding seems to be that the CourseGateway has ended up with it's own method with the same name but different method signature. While this wouldn't cause a bug on the course_manage_edit.php page since the code there is correctly accessing the courseClassGateway, it could cause AI coding tools to misunderstand this and believe that there is a bug.

We will aim to remove the duplicate method from CourseGateway, which is a knock-on effect of recent refactoring efforts. Thanks!

@SKuipers
Copy link
Copy Markdown
Member

I've pushed the commit here: 737b22e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants