Moodle
  1. Moodle
  2. MDL-31314

Restoring backups from 1.9 does not set grade_categories.depth

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.4, 2.2.1
    • Fix Version/s: 2.1.5, 2.2.2
    • Component/s: Backup, Gradebook
    • Labels:
    • Testing Instructions:
      Hide

      1. Restore the attached backup-moodle2-course-g100-20120126-1012-19export.mbz

      2. Go to the gradebook, edit categories page, and verify that the grade category has move and delete icons.

      3. Verify in the database that the grade_category is present, and that the depth and path fields are correct.

      Show
      1. Restore the attached backup-moodle2-course-g100-20120126-1012-19export.mbz 2. Go to the gradebook, edit categories page, and verify that the grade category has move and delete icons. 3. Verify in the database that the grade_category is present, and that the depth and path fields are correct.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
    • Rank:
      37783

      Description

      Moodle 1.9 did not write grade_categories.depth and grade_categories.path to the backup file because both of these can be re-constructed from grade_categories.parent.

      This is not totally a problem, because 2.x restore code computes grade_categories.path from parent on lines 375 - 400 of backup/moodle2/restore_stepslib.php

      However, it does not re-compute depth at the same time. It relies on the correct value being in the backup file which was not the case for a custom "Convert courses from 1.9 -> 2.x" system we developed at the OU>

      As a results, you get grade_categories in the DB with depth = 0.

      Surprisingly, this does not break very much. We only noticed it at the OU because the move icon is only shown on categories where depth > 0, and someone noticed that they could not move any categories in their course that came from 1.9.

        Issue Links

          Activity

          Tim Hunt created issue -
          Tim Hunt made changes -
          Field Original Value New Value
          Fix Version/s 2.1.5 [ 11553 ]
          Fix Version/s 2.2.2 [ 11552 ]
          Fix Version/s 2.3 [ 10657 ]
          Priority Minor [ 4 ] Critical [ 2 ]
          Labels triaged
          Assignee moodle.com [ moodle.com ] Tim Hunt [ timhunt ]
          Tim Hunt made changes -
          Status Open [ 1 ] Waiting for peer review [ 10012 ]
          Pull Master Diff URL https://github.com/timhunt/moodle/compare/master...MDL-31314
          Pull Master Branch MDL-31314
          Pull from Repository git://github.com/timhunt/moodle.git
          Eloy Lafuente (stronk7) made changes -
          Link This issue testing discovered MDL-31333 [ MDL-31333 ]
          Tim Hunt made changes -
          Status Waiting for peer review [ 10012 ] Development in progress [ 3 ]
          Tim Hunt made changes -
          Testing Instructions 1. On your Moodle 1.9 site, create a course with categories Category and Subcategory nested inside each other.

          2. Backup the course and restore to 2.x.

          3. Create the same gradebook structure in a new course in the 2.x site. Verify in the database that the grade_categories parent, depth and path fields are correct for all categories in these two courses.

          4. Verify that the when you edit the grade items in the restored course, each grade category has a move icon, and that you can move it somewhere else.
          1. Restore the attached backup-moodle2-course-g100-20120126-1012-19export.mbz

          2. Go to the gradebook, edit categories page, and verify that the grade category has move and delete icons.

          3. Verify in the database that the grade_category is present, and that the depth and path fields are correct.
          Description Moodle 1.9 did not write grade_categories.depth and grade_categories.path to the backup file because both of these can be re-constructed from grade_categories.parent.

          This is not totally a problem, because 2.x restore code computes grade_categories.path from parent on lines 375 - 400 of backup/moodle2/restore_stepslib.php

          However, it does not re-compute depth at the same time. It relies on the correct value being in the backup file which is not try when restoring a 1.9 backup.

          As a results, you get grade_categories in the DB with depth = 0.

          Surprisingly, this does not break very much. We only noticed it at the OU because the move icon is only shown on categories where depth > 0, and someone noticed that they could not move any categories in their course that came from 1.9.
          Moodle 1.9 did not write grade_categories.depth and grade_categories.path to the backup file because both of these can be re-constructed from grade_categories.parent.

          This is not totally a problem, because 2.x restore code computes grade_categories.path from parent on lines 375 - 400 of backup/moodle2/restore_stepslib.php

          However, it does not re-compute depth at the same time. It relies on the correct value being in the backup file which was not the case for a custom "Convert courses from 1.9 -> 2.x" system we developed at the OU>

          As a results, you get grade_categories in the DB with depth = 0.

          Surprisingly, this does not break very much. We only noticed it at the OU because the move icon is only shown on categories where depth > 0, and someone noticed that they could not move any categories in their course that came from 1.9.
          Pull 2.2 Diff URL https://github.com/timhunt/moodle/compare/MOODLE_22_STABLE...MDL-31314_22
          Pull 2.1 Branch MDL-31314_21
          Pull 2.2 Branch MDL-31314_22
          Pull 2.1 Diff URL https://github.com/timhunt/moodle/compare/MOODLE_21_STABLE...MDL-31314_21
          Attachment backup-moodle2-course-g100-20120126-1012-19export.mbz [ 26463 ]
          Tim Hunt made changes -
          Status Development in progress [ 3 ] Waiting for integration review [ 10010 ]
          Aparup Banerjee made changes -
          Currently in integration Yes [ 10041 ]
          Eloy Lafuente (stronk7) made changes -
          Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
          Integrator stronk7
          Eloy Lafuente (stronk7) made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          Fix Version/s 2.3 [ 10657 ]
          Adrian Greeve made changes -
          Tester abgreeve
          Adrian Greeve made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          Adrian Greeve made changes -
          Status Testing in progress [ 10011 ] Tested [ 10006 ]
          Eloy Lafuente (stronk7) made changes -
          Status Tested [ 10006 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Currently in integration Yes [ 10041 ]
          Integration date 02/Feb/12

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: