Skip to content

Commit

Permalink
fix (version): last bugfixes and preparing for new release that fixes #2
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Nolte committed Aug 18, 2022
1 parent e224bef commit 43f27ba
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 16 deletions.
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ this program. If not, see <http://www.gnu.org/licenses/>.

@copyright 2022 coactum GmbH

# Discourse #
# DisCourse #

## Description ##

Expand All @@ -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 …
Expand Down Expand Up @@ -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.
2 changes: 1 addition & 1 deletion db/uninstall.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
24 changes: 13 additions & 11 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 9 additions & 0 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit 43f27ba

Please sign in to comment.