Skip to content

Commit

Permalink
Merge pull request #65 from integral-learning/dev
Browse files Browse the repository at this point in the history
Release v1.6.2
  • Loading branch information
fsacha authored Nov 9, 2023
2 parents 154057b + 279b206 commit d4b8bdf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 7 deletions.
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# MumieTask - Changelog

All important changes to this plugin will be documented in this file.
## [v1.6.2] - 2023-11-09
### Fixed
- Grade synchronisation bug fixed
- Support php:7.4

## [v1.6.1] - 2023-10-31
### Added
- The language is sent with the worksheet during the note synchronization request.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function get_context(array $mumietasks, array $users): context {
* @return bool
*/
public static function requires_context(stdClass $mumie): bool {
return str_starts_with($mumie->taskurl, "worksheet_")
return (substr( $mumie->taskurl, 0, 10 ) === "worksheet_")
&& $mumie->duedate > 0;
}

Expand Down
6 changes: 4 additions & 2 deletions classes/grades/synchronization/xapi_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,18 @@ private function has_error(array $response): bool {
* @return mixed curl handle for json payload
*/
public function create_post_curl_request() {
$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, json_encode($this->payload));
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_USERAGENT, "My User Agent Name");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt(
$ch,
CURLOPT_HTTPHEADER,
array(
'Content-Type: application/json',
'Content-Length: ' . strlen(json_encode($this->payload)),
'Content-Length: ' . strlen($postfields),
"X-API-Key: " . get_config('auth_mumie', 'mumie_api_key'),
)
);
Expand Down
3 changes: 2 additions & 1 deletion gradesync.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +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();
$grade->userid = self::get_mumie_user_from_sync_id($xapigrade->actor->account->name)->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;
Expand Down
6 changes: 3 additions & 3 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2023103100; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2023110900; // The current module version (Date: YYYYMMDDXX).
$plugin->component = 'mod_mumie'; // Full name of the plugin (used for diagnostics).
$plugin->requires = 2022041900;
$plugin->release = "v1.6.1";
$plugin->release = "v1.6.2";
$plugin->maturity = MATURITY_STABLE;
$plugin->dependencies = array(
'auth_mumie' => 2023103100,
'auth_mumie' => 2023110900,
);

0 comments on commit d4b8bdf

Please sign in to comment.