diff --git a/classes/grades/synchronization/xapi_request.php b/classes/grades/synchronization/xapi_request.php index 666e1fc..f5185d4 100644 --- a/classes/grades/synchronization/xapi_request.php +++ b/classes/grades/synchronization/xapi_request.php @@ -75,10 +75,10 @@ private function has_error(array $response): bool { * @return mixed curl handle for json payload */ public function create_post_curl_request() { - $post_fields= json_encode($this->payload); + $postfields = json_encode($this->payload); $ch = curl_init($this->server->get_grade_sync_url()); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); - curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields); + curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); curl_setopt($ch, CURLOPT_USERAGENT, "My User Agent Name"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt( @@ -86,7 +86,7 @@ public function create_post_curl_request() { CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', - 'Content-Length: ' . strlen($post_fields), + 'Content-Length: ' . strlen($postfields), "X-API-Key: " . get_config('auth_mumie', 'mumie_api_key'), ) ); diff --git a/gradesync.php b/gradesync.php index 3d72926..cc090f7 100644 --- a/gradesync.php +++ b/gradesync.php @@ -189,8 +189,8 @@ public static function get_all_grades_for_user(stdClass $mumie, int $userid) : ? */ private static function xapi_to_moodle_grade($xapigrade) : stdClass { $grade = new stdClass(); - $sync_id = self::get_mumie_user_from_sync_id($xapigrade->actor->account->name); - $grade->userid = $sync_id->get_moodle_id(); + $syncid = self::get_mumie_user_from_sync_id($xapigrade->actor->account->name); + $grade->userid = $syncid->get_moodle_id(); $grade->rawgrade = 100 * $xapigrade->result->score->raw; $grade->timecreated = strtotime($xapigrade->timestamp); return $grade;