Moodle
  1. Moodle
  2. MDL-37078

Conditional section availability restore - only restores the first Activity completion condition

    Details

    • Testing Instructions:
      Hide
      1. Create new course
      2. Add two labels with Completion tracking set to 'Students can manually mark the activity as complete"
      3. Edit summary of of first course section
        • go to 'Restrict access'
          • set first 'Activity completion condition' select label 1 'must be marked complete'
          • set second 'Activity completion condition' select label 2 'must be marked complete'
        • Set 'Before section can be accessed' to 'Hide section entirely'
      4. switch role to 'Student' and test. First course section should be hidden until you mark Label 1 & 2 as complete.
      5. Backup course
      6. Restore backup as a new course
      7. Switch role to student again and try ticking/unticking the two boxes

      The hidden section should appear only when BOTH boxes are ticked.

      Show
      Create new course Add two labels with Completion tracking set to 'Students can manually mark the activity as complete" Edit summary of of first course section go to 'Restrict access' set first 'Activity completion condition' select label 1 'must be marked complete' set second 'Activity completion condition' select label 2 'must be marked complete' Set 'Before section can be accessed' to 'Hide section entirely' switch role to 'Student' and test. First course section should be hidden until you mark Label 1 & 2 as complete. Backup course Restore backup as a new course Switch role to student again and try ticking/unticking the two boxes The hidden section should appear only when BOTH boxes are ticked.
    • Affected Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull 2.4 Branch:
      MDL-37078-m24
    • Pull Master Branch:
      MDL-37078-master
    • Rank:
      46632

      Description

      1. Create new course
      2. Add two labels with Completion tracking set to 'Students can manually mark the activity as complete"
      3. Edit summary of of first course section
        • go to 'Restrict access'
          • set first 'Activity completion condition' select label 1 'must be marked complete'
          • set second 'Activity completion condition' select label 2 'must be marked complete'
        • Set 'Before section can be accessed' to 'Hide section entirely'
      4. switch role to 'Student' and test. First course section should be hidden until you mark Label 1 & 2 as complete.
      5. Backup course
      6. Restore backup as a new course
      7. Go to first section and it will only have restored the first activity completion condition, ignoring the second condition in the restore

        Activity

        Hide
        Sam Marshall added a comment -

        Ouch, really? That's pretty bad.

        Just updating some bug settings - I'll hopefully look at this properly in a few days.

        Show
        Sam Marshall added a comment - Ouch, really? That's pretty bad. Just updating some bug settings - I'll hopefully look at this properly in a few days.
        Hide
        Matthew Lowe added a comment -

        Tested on 2.3.3 and 2.4 and issue is present.

        Show
        Matthew Lowe added a comment - Tested on 2.3.3 and 2.4 and issue is present.
        Hide
        Sam Marshall added a comment -

        Investigation so far (continuing, will hopefully do fix soon) - I can confirm in current master.

        Also, when restoring in current master I got this error (which may or may not be related):

        Error: mdb->get_record() found more than one record!

        line 1394 of /lib/dml/moodle_database.php: call to debugging()
        line 1354 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql()
        line 1333 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
        line 1263 of /backup/moodle2/restore_stepslib.php: call to moodle_database->get_record()
        line 406 of /backup/util/plan/restore_structure_step.class.php: call to restore_section_structure_step->after_restore()
        line 106 of /backup/util/plan/restore_task.class.php: call to restore_structure_step->launch_after_restore_methods()
        line 167 of /backup/util/plan/restore_plan.class.php: call to restore_task->execute_after_restore()
        line 110 of /backup/moodle2/restore_final_task.class.php: call to restore_plan->execute_after_restore()
        line 475 of /backup/moodle2/restore_stepslib.php: call to restore_final_task->launch_execute_after_restore()
        line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_execute_after_restore->define_execution()
        line 153 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
        line 163 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
        line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
        line 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
        line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
        line 46 of /backup/restore.php: call to restore_ui->execute()

        After restore on view of course page I get this wall of errors (which are definitely related):

        Notice: Undefined property: condition_info_section::$cm in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1.

        {main}() /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280 Notice: Trying to get property of non-object in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1. {main}

        () /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280 Notice: Undefined property: condition_info_section::$cm in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1.

        {main}() /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280 Notice: Trying to get property of non-object in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1. {main}

        () /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info->_construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280
        Warning: activity '' has condition on deleted activity 868 (to get rid of this message, edit the named activity)

        line 946 of /lib/conditionlib.php: call to debugging()
        line 280 of /lib/conditionlib.php: call to condition_info_base->is_available()
        line 1692 of /lib/modinfolib.php: call to condition_info_section->is_available()
        line 337 of /lib/modinfolib.php: call to section_info->__construct()
        line 1341 of /lib/modinfolib.php: call to course_modinfo->__construct()
        line 1000 of /lib/completionlib.php: call to get_fast_modinfo()
        line 47 of /report/progress/lib.php: call to completion_info->get_activities()
        line 2457 of /lib/navigationlib.php: call to report_progress_extend_navigation_course()
        line 1133 of /lib/navigationlib.php: call to global_navigation->add_course_essentials()
        line 2918 of /lib/navigationlib.php: call to global_navigation->initialise()
        line 766 of /lib/pagelib.php: call to navbar->has_items()
        line 4 of /theme/formfactor/layout/general.php: call to moodle_page->has_navbar()
        line 804 of /lib/outputrenderers.php: call to include()
        line 734 of /lib/outputrenderers.php: call to core_renderer->render_page_layout()
        line 230 of /course/view.php: call to core_renderer->header()

        Show
        Sam Marshall added a comment - Investigation so far (continuing, will hopefully do fix soon) - I can confirm in current master. Also, when restoring in current master I got this error (which may or may not be related): Error: mdb->get_record() found more than one record! line 1394 of /lib/dml/moodle_database.php: call to debugging() line 1354 of /lib/dml/moodle_database.php: call to moodle_database->get_record_sql() line 1333 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select() line 1263 of /backup/moodle2/restore_stepslib.php: call to moodle_database->get_record() line 406 of /backup/util/plan/restore_structure_step.class.php: call to restore_section_structure_step->after_restore() line 106 of /backup/util/plan/restore_task.class.php: call to restore_structure_step->launch_after_restore_methods() line 167 of /backup/util/plan/restore_plan.class.php: call to restore_task->execute_after_restore() line 110 of /backup/moodle2/restore_final_task.class.php: call to restore_plan->execute_after_restore() line 475 of /backup/moodle2/restore_stepslib.php: call to restore_final_task->launch_execute_after_restore() line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_execute_after_restore->define_execution() line 153 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute() line 163 of /backup/util/plan/base_plan.class.php: call to base_task->execute() line 157 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute() line 315 of /backup/controller/restore_controller.class.php: call to restore_plan->execute() line 147 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan() line 46 of /backup/restore.php: call to restore_ui->execute() After restore on view of course page I get this wall of errors (which are definitely related): Notice: Undefined property: condition_info_section::$cm in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1. {main}() /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_ construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info-> _construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280 Notice: Trying to get property of non-object in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1. {main} () /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_ construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info-> _construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280 Notice: Undefined property: condition_info_section::$cm in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1. {main}() /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_ construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info-> _construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280 Notice: Trying to get property of non-object in /fs1/www_root/sm449/coremoodle/lib/conditionlib.php on line 945 Call Stack: 0.0008 776224 1. {main} () /fs1/www_root/sm449/coremoodle/course/view.php:0 0.3372 44306936 2. core_renderer->header() /fs1/www_root/sm449/coremoodle/course/view.php:230 0.3512 45046664 3. core_renderer->render_page_layout() /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:734 0.3515 45135192 4. include('/fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php') /fs1/www_root/sm449/coremoodle/lib/outputrenderers.php:804 0.3515 45135776 5. moodle_page->has_navbar() /fs1/www_root/sm449/coremoodle/theme/formfactor/layout/general.php:4 0.3520 45142832 6. navbar->has_items() /fs1/www_root/sm449/coremoodle/lib/pagelib.php:766 0.3525 45157984 7. global_navigation->initialise() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2918 0.3844 45844464 8. global_navigation->add_course_essentials() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:1133 0.3912 45934376 9. report_progress_extend_navigation_course() /fs1/www_root/sm449/coremoodle/lib/navigationlib.php:2457 0.3913 45935064 10. completion_info->get_activities() /fs1/www_root/sm449/coremoodle/report/progress/lib.php:47 0.3927 45944256 11. get_fast_modinfo() /fs1/www_root/sm449/coremoodle/lib/completionlib.php:1000 0.3927 45945376 12. course_modinfo->_ construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1341 0.3944 46007624 13. section_info-> _construct() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:337 0.3949 46015736 14. condition_info_section->is_available() /fs1/www_root/sm449/coremoodle/lib/modinfolib.php:1692 0.3949 46015736 15. condition_info_base->is_available() /fs1/www_root/sm449/coremoodle/lib/conditionlib.php:280 Warning: activity '' has condition on deleted activity 868 (to get rid of this message, edit the named activity) line 946 of /lib/conditionlib.php: call to debugging() line 280 of /lib/conditionlib.php: call to condition_info_base->is_available() line 1692 of /lib/modinfolib.php: call to condition_info_section->is_available() line 337 of /lib/modinfolib.php: call to section_info->__construct() line 1341 of /lib/modinfolib.php: call to course_modinfo->__construct() line 1000 of /lib/completionlib.php: call to get_fast_modinfo() line 47 of /report/progress/lib.php: call to completion_info->get_activities() line 2457 of /lib/navigationlib.php: call to report_progress_extend_navigation_course() line 1133 of /lib/navigationlib.php: call to global_navigation->add_course_essentials() line 2918 of /lib/navigationlib.php: call to global_navigation->initialise() line 766 of /lib/pagelib.php: call to navbar->has_items() line 4 of /theme/formfactor/layout/general.php: call to moodle_page->has_navbar() line 804 of /lib/outputrenderers.php: call to include() line 734 of /lib/outputrenderers.php: call to core_renderer->render_page_layout() line 230 of /course/view.php: call to core_renderer->header()
        Hide
        Sam Marshall added a comment -

        By the way, thanks for reporting this bug and testing on various versions. Now that I found the problem, I can confirm that the bug applies on all versions that contain conditional section access (2.3 onward).

        The fix given, which I will now submit for code review, contains two corrections:

        1) The code that updates the ids when restoring section availability conditions used get_record to get the conditions, when in fact there can be multiple. So it only ever worked for one of the conditions. I changed to get_records.

        2) The code that displays a warning when there is an invalid availability condition in the database referred to an old variable name which no longer exists (which is why I got a wall of errors on the course page instead of one warning), I changed this to the new variable name.

        I will put the fix onto 2.4 and 2.3 branches after code review, then submit for integration.

        Show
        Sam Marshall added a comment - By the way, thanks for reporting this bug and testing on various versions. Now that I found the problem, I can confirm that the bug applies on all versions that contain conditional section access (2.3 onward). The fix given, which I will now submit for code review, contains two corrections: 1) The code that updates the ids when restoring section availability conditions used get_record to get the conditions, when in fact there can be multiple. So it only ever worked for one of the conditions. I changed to get_records. 2) The code that displays a warning when there is an invalid availability condition in the database referred to an old variable name which no longer exists (which is why I got a wall of errors on the course page instead of one warning), I changed this to the new variable name. I will put the fix onto 2.4 and 2.3 branches after code review, then submit for integration.
        Hide
        Tim Hunt added a comment -

        +1 looks good to me. Don't forget to write the testing instructions.

        Show
        Tim Hunt added a comment - +1 looks good to me. Don't forget to write the testing instructions.
        Hide
        Sam Marshall added a comment -

        Thanks Tim. The reporter already wrote excellent testing instructions so I have now just copy/pasted

        Note: The change did not quite cherry-pick to 2.3, but in actual fact the changed line was different (next to the change I made) so it was easy to resolve the conflict.

        Show
        Sam Marshall added a comment - Thanks Tim. The reporter already wrote excellent testing instructions so I have now just copy/pasted Note: The change did not quite cherry-pick to 2.3, but in actual fact the changed line was different (next to the change I made) so it was easy to resolve the conflict.
        Hide
        Sam Marshall added a comment -

        Submitting this bugfix for integration.

        Show
        Sam Marshall added a comment - Submitting this bugfix for integration.
        Hide
        Dan Poltawski added a comment -

        Thanks Sam. I've integrated this to master, 24 and 23.

        Show
        Dan Poltawski added a comment - Thanks Sam. I've integrated this to master, 24 and 23.
        Hide
        Adrian Greeve added a comment -

        Tested on the 2.3, 2.4 and master branches.
        I noted that when we do a restore of the course now that both the conditions are needed to show the hidden section (as was the case before), which I assume is the action that we want to happen (The testing instructions are just a copy of the description).
        Test passed.

        Show
        Adrian Greeve added a comment - Tested on the 2.3, 2.4 and master branches. I noted that when we do a restore of the course now that both the conditions are needed to show the hidden section (as was the case before), which I assume is the action that we want to happen (The testing instructions are just a copy of the description). Test passed.
        Hide
        Sam Marshall added a comment -

        Thanks! You are right, that is the correct result and I just forgot to edit the test script when I copied it.

        I've edited the test script now, a bit late but just for the record.

        Show
        Sam Marshall added a comment - Thanks! You are right, that is the correct result and I just forgot to edit the test script when I copied it. I've edited the test script now, a bit late but just for the record.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Changes are now upstream, thanks for your collaboration!

        If you are going to have any celebration next days, enjoy with your gang, if not, too!

        Ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Changes are now upstream, thanks for your collaboration! If you are going to have any celebration next days, enjoy with your gang, if not, too! Ciao

          People

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

            Dates

            • Created:
              Updated:
              Resolved: