Timetable: fix course edit page missing parameter and columns#2085
Timetable: fix course edit page missing parameter and columns#2085brianp-matrix wants to merge 2 commits into
Conversation
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>
SKuipers
left a comment
There was a problem hiding this comment.
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!
|
I've pushed the commit here: 737b22e |
Summary
course_manage_edit.phpline 143 calledselectClassesByCourseID()with only 1 argument, but the method requires 2 ($gibbonCourseID,$gibbonSchoolYearID), causing anArgumentCountErrorCourseGateway::selectClassesByCourseID()also only returnedgibbonCourseClassID,course, andclass— missing the columns needed by the DataTable:teachersTotal,studentsActive,studentsExpected,studentsTotal,name,reportable,enrolmentMin,enrolmentMaxgibbonCourseClassPersonandgibbonPersonwith COUNT aggregations to provide all required columnsTest plan