Closed mcquenji closed 2 months ago
yknow what I'm just gonna make a model class for course
and unfuck this whole shit
I found the probable cause of this being in course_helper
public static function get_lbplanner_course(int $courseid, int $userid): stdClass {
global $DB;
return $DB->get_record(self::LBPLANNER_COURSE_TABLE, ['courseid' => $courseid, 'userid' => $userid]);
}
yep, zero checking nor type conversion
update: nope, seems like the DB also stores them as integers. I'm gonna continue implementing the model while trying to find the issue
The issue would be resolved if the API just returned 0/1. instead of false/true
The following payload produces an error with the server complaining about an incorrect datatype.
Click to see error message
``` [WARNING] Datasources.MoodleCourse.StdMoodleCourseDatasource: Failed to update course ApiServiceException: Invalid parameter value detected (enabled => Invalid parameter value detected (Invalid external api parameter: the value is "true", the server was expecting "bool" type): Invalid external api parameter: the value is "true", the server was expecting "bool" type) (status code: 200) { exception: invalid_parameter_exception, errorcode: invalidparameter, message: Invalid parameter value detected (enabled => Invalid parameter value detected (Invalid external api parameter: the value is "true", the server was expecting "bool" type): Invalid external api parameter: the value is "true", the server was expecting "bool" type), debuginfo: enabled => Invalid parameter value detected (Invalid external api parameter: the value is "true", the server was expecting "bool" type): Invalid external api parameter: the value is "true", the server was expecting "bool" type } ```iirc Moodle uses 0/1 to represent booleans, however when calling
local_lbplanner_courses_get_all_courses
I get an actual bool with false/true.