Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-33176

Duplicating an activity will occasionally duplicate some groups in a course

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.2.1, 3.5, 3.5.2
    • Fix Version/s: None
    • Component/s: Backup
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_35_STABLE

      Description

      After duplicating an activity in a course, some groups in that course are duplicated.

      Investigation showed that this is basically happening because the teacher who сreated the groups which are duplicating, presumably did not type the descriptions in Moodle, but copypasted them from an office app, such as MS Word.

      When duplicating activity, Moodle actually backs it up, including groups, and then restores it as a new copy. Each group from backup is checked if it already exists in the course and if not, it's (re-)created. To do the check, Moodle searches for groups which names AND descriptions exactly match those in backup. See restore_stepslib.php, function process_group().

      If group description is pasted from MS Word, it may contain character sequences 0D 0A (\r\n) which are sanitized somewhere on backup being converted to a single byte character 0A (\n), hence group description in backup will not strictly match that in the database and the group will duplicate.

      Attaching 2 files:
      1. desc-db.txt — description of a group containing special characters, retrieved from the database.
      2. groups.xml — groups file from course backup.

        Attachments

        1. desc-db.txt
          0.1 kB
          Kirill Astashov
        2. groups.xml
          2 kB
          Kirill Astashov
        3. MDL-33176-immediate-fix.diff
          1 kB
          Kirill Astashov

          Issue Links

            Activity

              People

              Assignee:
              mhughes2k Michael Hughes
              Reporter:
              badblock Kirill Astashov
              Participants:
              Component watchers:
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              4 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated: