-
Bug
-
Resolution: Fixed
-
Critical
-
2.1.1, 2.1.2, 2.2
-
None
-
MOODLE_21_STABLE, MOODLE_22_STABLE
-
MOODLE_20_STABLE, MOODLE_21_STABLE
-
MDL-29350-master-2 -
When duplicating activities in a course (using the "Duplicate" icon), duplicate records may be inserted into the groupings_groups table.
To reproduce:
- Create an empty course.
- Create one grouping in the course, then create one group in this grouping.
- Create an activity (say, an assignment), set it to "Visible groups", and restrict it to the grouping.
- Click the "Duplicate" button and confirm.
- Now run the following query manually on the DB:
SELECT COUNT(id) AS idcnt, MIN(id) AS firstid, groupingid, groupid FROM mdl_groupings_groups GROUP BY groupingid, groupid HAVING idcnt>1;
This will now show (at least) one line with idcnt=2.
Any further duplication will double the number of rows. On my production system, there's one groupingid-groupid pair which has 16384 table entries. Since many parts of the code assume that (groupingid, groupid) is unique, this leads to various strange effects in different places of Moodle, for example in the screens that assign groups to groupings.
The reason for this is in the backup/restore code in restore_groups_structure_step::process_grouping_group() . This "restores" a groupings_groups entry even if it already exists.
Patch to follow.
- has been marked as being related by
-
MDL-30825 Duplicating activities causes duplicate rows in course_completion_aggr_methd when course completion enabled
-
- Closed
-
-
MDL-33176 Duplicating an activity will occasionally duplicate some groups in a course
-
- Closed
-
-
MDL-34605 Groups duplication after duplicating an activity
-
- Closed
-