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

Upgrading assignments in 2.7/2.8 does not work when conditional access is used

    Details

    • Testing Instructions:
      Hide
      1. Create a 2.2 Moodle site and a course
      2. Set debugging mode on, don't be scared of all these messages everywhere
      3. Enable completion tracking and conditional access
      4. Add couple of assignment module instances
      5. Add a couple of forums, each one requiring one of the assignments created above to be completed (set a grade requirement for example) as a restrict access condition
      6. Would be worth to backup the database at this stage because you have to repeat the test for more than one version
      7. Upgrade moodle
      8. Access the course
      9. You SHOULD not see any error regarding unexisting activities
      10. Click to edit the forums settings, in restricted access, see that the assignments are linked as conditions
      11. Move to admin/tool/assignmentupgrade/index.php and list the not upgraded assignments
      12. Press upgrade all assignments and on the next page "Continue"
      13. The process SHOULD finish as expected without any error
      14. Move to the course (you have a link in the results page)
      15. You should have as many assignments as you created in step #4
      16. Click on the assignment activities, they SHOULD work as usual
      17. Click to edit the forum activities, in restrict access section, the conditions SHOULD point to the current assignment modules ids and, in the list you SHOULD only see as many options as activities you created in #4 and #5
      Show
      Create a 2.2 Moodle site and a course Set debugging mode on, don't be scared of all these messages everywhere Enable completion tracking and conditional access Add couple of assignment module instances Add a couple of forums, each one requiring one of the assignments created above to be completed (set a grade requirement for example) as a restrict access condition Would be worth to backup the database at this stage because you have to repeat the test for more than one version Upgrade moodle Access the course You SHOULD not see any error regarding unexisting activities Click to edit the forums settings, in restricted access, see that the assignments are linked as conditions Move to admin/tool/assignmentupgrade/index.php and list the not upgraded assignments Press upgrade all assignments and on the next page "Continue" The process SHOULD finish as expected without any error Move to the course (you have a link in the results page) You should have as many assignments as you created in step #4 Click on the assignment activities, they SHOULD work as usual Click to edit the forum activities, in restrict access section, the conditions SHOULD point to the current assignment modules ids and, in the list you SHOULD only see as many options as activities you created in #4 and #5
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-50177_master

      Description

      In 2.7 and in 2.8 when upgrading 2.2 assignments you will get the following error:

      The assignment conversion was not successful. The log from the upgrade was:
      Could not convert assignment. Exception was: Coding error detected, it must be fixed by a programmer: Missing or invalid ->cm for completion condition.

      If you go to the course where the assignment is at and turn editing on you will see something like this:

      Error processing availability data for ‘A412 Advanced IQE Equipment Training Certificate’: Missing or invalid ->cm for completion condition
      
          line 302 of /availability/classes/info.php: call to debugging()
          line 241 of /availability/classes/info.php: call to core_availability\info->warn_about_invalid_availability()
          line 715 of /course/renderer.php: call to core_availability\info->is_available_for_all()
          line 831 of /course/renderer.php: call to core_course_renderer->is_cm_conditionally_hidden()
          line 1013 of /course/renderer.php: call to core_course_renderer->course_section_cm_text()
          line 924 of /course/renderer.php: call to core_course_renderer->course_section_cm()
          line 1093 of /course/renderer.php: call to core_course_renderer->course_section_cm_list_item()
          line 782 of /course/format/renderer.php: call to core_course_renderer->course_section_cm_list()
          line 56 of /course/format/topics/format.php: call to format_section_renderer_base->print_multiple_section_page()
          line 281 of /course/view.php: call to require()
      

      This is happening because there is a certificate in the course with restrictions based on the old 2.2 assignments and the code is not updating the cmid for the restrictions in the database for that certificate. The only way we have found to get around it is to upgrade the assignment ONE AT A TIME and then edit and save the certificate in between each. This is a lot of work when there are over 2000 of the old assignment types to upgrade and many certificates that are restricted based on them.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                8 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  6/Jul/15