diff --git a/README.md b/README.md index be25566..fcb4918 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ this program. If not, see . @copyright 2022 coactum GmbH -# Discourse # +# DisCourse # ## Description ## @@ -27,7 +27,7 @@ In this way, the DisCourse enables the participants to work together to develop On the overview page teachers can … * See all phases and their deadlines and hints specified when the activity was created -* See a brief summary of all DisCourse groups and their submission states and open the group pages for * each of these groups +* See a brief summary of all DisCourse groups and their submission states and open the group pages for each of these groups * Switch phases (phases can also be switched automatically by Moodle at the specified deadline) Students can … @@ -57,3 +57,23 @@ Students can additionally hand in a submission for the group if the phase of the ## Dependencies ## No dependencies. + +## Incompatibilities ## +- Incompatible with 3rd party plugin block_sharing_cart (https://moodle.org/plugins/block_sharing_cart). If you try to copy a DisCourse with the Sharing-Cart it may create an incomplete and unusable DisCourse. + +## Changelog ## +- [1.2.0]: + - [Bugfix]: Deleting expired contexts via Moodle privacy mechanism now deletes all groups and groupings of a DisCourse (the grouping wich id is stored for the instance in the table mod_discourse and its groups). + - [Bugfix]: Deleting the whole plugin now removes all groupings connected with DisCourses (and all groups in this groupings). + - [Bugfix]: Renaming a DisCourse (in the edit settings, not via the quick edit option in the course) now renames groups and groupings connected with the DisCourse to its new name. + - [Bugfix]: Manual renaming of groups wont break the display of the shortened group names anymore. + - [Bugfix]: For DisCourse groups messaging is now enabled by default. + - [Bugfix]: If an invalid groupingid is stored for a DisCourse or the grouping stored for a DisCourse is deleted, other course groups are not displayed in the DisCourse anymore. + - [Feature]: Added possibility to backup and restore DisCourses via Moodle backup api. + - [Note]: If you restore a DisCourse within its original course Moodle does not create new groupings and groups. So no grouping is assigned with the new DisCourse and no participants or submissions are recreated. + - [Note]: Incompatible with 3rd party plugin block_sharing_cart (https://moodle.org/plugins/block_sharing_cart). If you try to copy a DisCourse with the Sharing-Cart it may create an incomplete and unusable DisCourse. + - [Feature]: DisCourses can now be included in the course reset. + - [Versions]: Tested for Moodle 3.9, 3.10, 3.11 and 4.0 + - [Note]: Still uses old icon in Moodle 4.0 + - [Known issue]: Minor display issues with some themes in Moodle 4.0 if sidebars are open and display is too small + - [Known issue]: After duplicating an activity in Moodle 4.0 Moodle returns the wrong activity allowed groups (for the original activity). In this case no groups but an error message is shown and the activity cant be used correctly. Teachers may just wait a few minutes, rename an activity in the course or contact the moodle administrator to clear the moodle cache to fix this issue. diff --git a/db/uninstall.php b/db/uninstall.php index c905c03..6bb9a62 100644 --- a/db/uninstall.php +++ b/db/uninstall.php @@ -33,7 +33,7 @@ function xmldb_discourse_uninstall() { require_once("$CFG->dirroot/group/lib.php"); // Delete all groupings associated with discourses. - $discourses = $DB->get_recordset_select('discourse', array()); + $discourses = $DB->get_recordset('discourse'); if ($discourses->valid()) { foreach ($discourses as $discourse) { diff --git a/lib.php b/lib.php index d9124ec..b105855 100644 --- a/lib.php +++ b/lib.php @@ -158,19 +158,21 @@ function discourse_delete_instance($id) { $moduleinstance = $DB->get_record('discourse', array('id' => $id)); } - // Delete discourse groups. - $groups = groups_get_all_groups($moduleinstance->course, 0, $moduleinstance->groupingid); + if ($moduleinstance->groupingid != 0) { + // Delete discourse groups. + $groups = groups_get_all_groups($moduleinstance->course, 0, $moduleinstance->groupingid); - foreach ($groups as $group) { - groups_delete_group($group); - } + foreach ($groups as $group) { + groups_delete_group($group); + } - // Check if grouping is in same course as module instance - // (should not be neccessary but better be safe then sorry). - $grouping = groups_get_grouping($moduleinstance->groupingid); - if (!empty($grouping) && $grouping->courseid == $moduleinstance->course) { - // Delete discourse grouping. - groups_delete_grouping($moduleinstance->groupingid); + // Check if grouping is in same course as module instance + // (should not be neccessary but better be safe then sorry). + $grouping = groups_get_grouping($moduleinstance->groupingid); + if (!empty($grouping) && $grouping->courseid == $moduleinstance->course) { + // Delete discourse grouping. + groups_delete_grouping($moduleinstance->groupingid); + } } // Delete discourse participants. diff --git a/locallib.php b/locallib.php index ea40dbc..5ab0360 100644 --- a/locallib.php +++ b/locallib.php @@ -113,6 +113,15 @@ function compare($a, $b) { foreach ($groups as $group) { + // Fix for caching bug in Moodle 4.0 where groups_get_activity_allowed_groups returns the groups of the original cm after duplicating an activity (despite the correct grouping is connected with the duplicated discourse) -> can be "fixed" by clearing the moodle cache or renaming an course activity + $control = $DB->get_record('groupings_groups', array('groupingid' => $this->instance->groupingid, 'groupid' => $group->id)); + if (!$control) { + $groups = array(); + + \core\notification::add('Wrong groups found due to an internal moodle error. No groups are displayed. If this activity previously was duplicated you should just wait a few minutes and then reload your browser. If this issue remains the teacher should try renaming an activity in the course or ask the moodle administrator to clear the moodle cache to fix this error.', 'error'); + break; + } + // Define phase of group. if (stripos($group->idnumber, 'phase_1')) { $group->phase = 1; diff --git a/version.php b/version.php index 9e6fffc..a8c48ba 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'mod_discourse'; -$plugin->release = '1.1.3'; -$plugin->version = 2022051600; +$plugin->release = '1.2.0'; +$plugin->version = 2022081800; $plugin->requires = 2020061500; $plugin->maturity = MATURITY_STABLE;