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

Fatal error when restoring a Moodle 3.11 course with competencies to 4.1

XMLWordPrintable

    • MOODLE_311_STABLE, MOODLE_401_STABLE, MOODLE_402_STABLE, MOODLE_403_STABLE
    • MOODLE_402_STABLE, MOODLE_403_STABLE
    • MDL-77779-403
    • MDL-77779-main
    • Hide
        1. In 3.11, create a simple competencies framework which has a couple of competencies.
          • Create the framework in Site admin > Competencies > Competency > Add a new competency framework, with some simple settings: for name, put "Test Framework" for id number, "TEST1" and use the default compentence scale and Save changes.
          • In Site admin > Competencies > Competencies frameworks, click on the name of the new Test Framework to enter the competencies page. First select "Test Framework" in the combo list on left so that the "Add competency" button will appear on the right. Click that to add a competency. Give it a name of "Level 1" and an id number of "Level 1" and click Save changes. Repeat this process with a second competency, calling it "Level 2" so that you now have a couple to work with.
        2. Export then Import the framework to the 4.1/4.2 site
          • In the 3.11 site go to Site admin > Competencies > Export competency framework. Choose the "Test Framework" and click Export. Download and save the resulting csv file.
          • in the 4.1/4.2 site, go to Site admin > Competencies > Import competency framework and upload the saved csv file and click Import. On the Confirm column mappings page, keep the default settings and click Confirm. The import will be quick: click Continue. Then you will be on the Framework page and can verify you see the Framework in the list and it has the two competencies in it.
        1. In the 3.11 site, assign competencies to some course activities
          • Create a new, basic course, such as via Site admin > Development > Make a test course. It can be the smallest size. It needs to have a couple of activities in it, it doesn't matter which ones.
          • In the new course, go to Course admin > Competencies and click button "Add competencies to course". From the "Test Framework" add the Level 1 and Level 2 competencies.
          • Return to the main course page, turn editing on, and choose any activity in the course and choose Edit > Edit settings > Competencies, and in the "Course competencies" select pulldown, select or search for "Level 1".  You can leave the 
            "Upon activity completion" set to "Do nothing". Click the Save and return to course button.
          • Repeat previous step on another activity in the course and link it to the Level 2 competency.  You now have two activities linked to competencies.
        1. Now back up the course in Course admin > Backup. You can uncheck "Include enrolled users" if you want, it doesn't matter. Leave other things at the default but make sure that "Include competencies" is checked on. Complete the backup as usual with Jump to final step, and when ready download the backup file from Course admin > Restore.
        2. Ensure debugging is enabled
        3. In the 4.2+ site, restore the course backup via Site admin > Courses > Restore course and upload the saved backup file. Once uploaded, you will do a ful restore as a new course. Include everything in the back up, making sure that on step "3. Settings" that "Include competencies" option is checked on. On the final page, click Perform restore.
        4. Ensure process finishes with no errors
      Show
      In 3.11, create a simple competencies framework which has a couple of competencies. Create the framework in Site admin > Competencies > Competency > Add a new competency framework, with some simple settings: for name, put "Test Framework" for id number, "TEST1" and use the default compentence scale and Save changes. In Site admin > Competencies > Competencies frameworks, click on the name of the new Test Framework to enter the competencies page. First select "Test Framework" in the combo list on left so that the "Add competency" button will appear on the right. Click that to add a competency. Give it a name of "Level 1" and an id number of "Level 1" and click Save changes. Repeat this process with a second competency, calling it "Level 2" so that you now have a couple to work with. Export then Import the framework to the 4.1/4.2 site In the 3.11 site go to Site admin > Competencies > Export competency framework. Choose the "Test Framework" and click Export. Download and save the resulting csv file. in the 4.1/4.2 site, go to Site admin > Competencies > Import competency framework and upload the saved csv file and click Import. On the Confirm column mappings page, keep the default settings and click Confirm. The import will be quick: click Continue. Then you will be on the Framework page and can verify you see the Framework in the list and it has the two competencies in it. In the 3.11 site, assign competencies to some course activities Create a new, basic course, such as via Site admin > Development > Make a test course. It can be the smallest size. It needs to have a couple of activities in it, it doesn't matter which ones. In the new course, go to Course admin > Competencies and click button "Add competencies to course". From the "Test Framework" add the Level 1 and Level 2 competencies. Return to the main course page, turn editing on, and choose any activity in the course and choose Edit > Edit settings > Competencies, and in the "Course competencies" select pulldown, select or search for "Level 1".  You can leave the  "Upon activity completion" set to "Do nothing". Click the Save and return to course button. Repeat previous step on another activity in the course and link it to the Level 2 competency.  You now have two activities linked to competencies. Now back up the course in Course admin > Backup. You can uncheck "Include enrolled users" if you want, it doesn't matter. Leave other things at the default but make sure that "Include competencies" is checked on. Complete the backup as usual with Jump to final step, and when ready download the backup file from Course admin > Restore. Ensure debugging is enabled In the 4.2+ site, restore the course backup via Site admin > Courses > Restore course and upload the saved backup file. Once uploaded, you will do a ful restore as a new course. Include everything in the back up, making sure that on step "3. Settings" that "Include competencies" option is checked on. On the final page, click Perform restore. Ensure process finishes with no errors
    • 3
    • Team Alpha - Sprint 3 I1-2024

      When restoring a course from Moodle 3.11 into 4.1 which has course competencies assigned to modules, the restore halts with the error:

      Warning: Undefined property: stdClass::$overridegrade in /path/to/moodle//backup/moodle2/restore_stepslib.php on line 3752

      Debug info: overridegrade: Data submitted is invalid
      Error code: invalidpersistenterror

      I have tracked this down to the code related to MDL-56567 which has added a new field & column for the module level competency to allow a user override. However, this field is missing from 3.11 (and earlier) and so the backup xml file for the module competencies is missing that field. On restore, this error is generated.

      The code at line 3741 of backup/moodle2/restore_stepslib.php does not check to see whether $record->overridegrade exists in the backup xml, it assumes it just does the assign. This is what is generating the error.

      Suggested fix is to add some error checking there and set a default value in column instead.

      This is a BLOCKER at the moment for the restore of courses with competencies linked to modules since the only way to restore such courses is to leave out the competencies altogether.

      Steps to replicate:

      1. In 3.11, create a simple competencies framework which has a couple of competencies.
        • Create the framework in Site admin > Competencies > Competency > Add a new competency framework, with some simple settings: for name, put "Test Framework" for id number, "TEST1" and use the default compentence scale and Save changes.
        • In Site admin > Competencies > Competencies frameworks, click on the name of the new Test Framework to enter the competencies page. First select "Test Framework" in the combo list on left so that the "Add competency" button will appear on the right. Click that to add a competency. Give it a name of "Level 1" and an id number of "Level 1" and click Save changes. Repeat this process with a second competency, calling it "Level 2" so that you now have a couple to work with.
      2. Export then Import the framework to the 4.1/4.2 site
        • In the 3.11 site go to Site admin > Competencies > Export competency framework. Choose the "Test Framework" and click Export. Download and save the resulting csv file.
        • in the 4.1/4.2 site, go to Site admin > Competencies > Import competency framework and upload the saved csv file and click Import. On the Confirm column mappings page, keep the default settings and click Confirm. The import will be quick: click Continue. Then you will be on the Framework page and can verify you see the Framework in the list and it has the two competencies in it.
      1. In the 3.11 site, assign competencies to some course activities
        • Create a new, basic course, such as via Site admin > Development > Make a test course. It can be the smallest size. It needs to have a couple of activities in it, it doesn't matter which ones.
        • In the new course, go to Course admin > Competencies and click button "Add competencies to course". From the "Test Framework" add the Level 1 and Level 2 competencies.
        • Return to the main course page, turn editing on, and choose any activity in the course and choose Edit > Edit settings > Competencies, and in the "Course competencies" select pulldown, select or search for "Level 1".  You can leave the 
          "Upon activity completion" set to "Do nothing". Click the Save and return to course button.
        • Repeat previous step on another activity in the course and link it to the Level 2 competency.  You now have two activities linked to competencies.
      1. Now back up the course in Course admin > Backup. You can uncheck "Include enrolled users" if you want, it doesn't matter. Leave other things at the default but make sure that "Include competencies" is checked on. Complete the backup as usual with Jump to final step, and when ready download the backup file from Course admin > Restore.
      2. Ensure debugging is enabled
      3. In the 4.1/4.2 site, restore the course backup via Site admin > Courses > Restore course and upload the saved backup file. Once uploaded, you will do a ful restore as a new course. Include everything in the back up, making sure that on step "3. Settings" that "Include competencies" option is checked on. On the final page, click Perform restore.
      4. See the error message 

        Warning: Undefined property: stdClass::$overridegrade in /srv/www/moodle42a/backup/moodle2/restore_stepslib.php on line 3755
        Error: Data submitted is invalid
        More information about this error
        Debug info: overridegrade: Data submitted is invalid
        Error code: invalidpersistenterror

        This is a fatal error and so your only choice is to click Continue and the Restore will be be canceled.

            ilyatregubov Ilya Tregubov
            thornedu Randy Thornton
            Mihail Geshoski Mihail Geshoski
            Glyn (Mathew) May Glyn (Mathew) May
            Kim Jared Lucas Kim Jared Lucas
            Votes:
            5 Vote for this issue
            Watchers:
            14 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 4 hours, 15 minutes
                4h 15m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.