diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f6f4e0..8ad317e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,14 @@ # Change Log All notable changes to this project will be documented in this file. -## [2.6.2] 2024-12-14 (dev) +## [2.6.2] 2024-12-16 (dev) +### Added - Performance optimization: Now caches login state. - New {firstnamephonetic} tag. - New {lastnamephonetic} tag. - New {middlename} tag. +### Updated +- Fix-312: ifactivitycompleted and ifnotactivitycompleted now works correctly with graded activities. ## [2.6.1] 2024-11-20 ### Update diff --git a/classes/text_filter.php b/classes/text_filter.php index 47b7521..30a3e60 100644 --- a/classes/text_filter.php +++ b/classes/text_filter.php @@ -4006,8 +4006,8 @@ function ($matches) use ($USER) { if (($cm = \get_coursemodule_from_id('', $cmid, 0)) !== false) { // Get the completion data for this activity if it exists. try { - $data = $completion->get_data($cm, true, $USER->id); - $iscompleted = ($data->completionstate == COMPLETION_COMPLETE); + $data = $completion->get_data($cm, false, $USER->id); + $iscompleted = ($data->completionstate > COMPLETION_INCOMPLETE); // A completed state. } catch (\moodle_exception $e) { // Handle Moodle-specific exceptions. unset($e); @@ -4051,15 +4051,15 @@ function ($matches) use ($USER) { // Only process valid IDs. if (($cm = \get_coursemodule_from_id('', $cmid, 0)) !== false) { - // Get the completion data for this activity. + // Get the completion data for this activity if it exists. try { - $data = $completion->get_data($cm, true, $USER->id); - $iscompleted = ($data->completionstate == COMPLETION_COMPLETE); + $data = $completion->get_data($cm, false, $USER->id); + $iscompleted = ($data->completionstate > COMPLETION_INCOMPLETE); // A completed state. } catch (\moodle_exception $e) { // Handle Moodle-specific exceptions. unset($e); continue; - } catch (Exception $e) { + } catch (\Exception $e) { unset($e); continue; }