Moodle
  1. Moodle
  2. MDL-34259

Lesson breaks when user does not select an answer

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.4, 2.3.1
    • Fix Version/s: 2.2.5, 2.3.2
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide
      1. Create a lesson
      2. Add a true/false question
      3. Attempt the lesson as a student
      4. Make sure the lesson does not break if you submit the form without any answer selected
      5. Select an answer and submit
      6. Login as a teacher
      7. View the lesson report
      8. Make sure the student submission has been saved
      Show
      Create a lesson Add a true/false question Attempt the lesson as a student Make sure the lesson does not break if you submit the form without any answer selected Select an answer and submit Login as a teacher View the lesson report Make sure the student submission has been saved
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE, MOODLE_23_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-34259-master
    • Rank:
      42610

      Description

      Replication steps

      1. Create a lesson
      2. Add a true/false question
      3. Attempt the lesson as a student
      4. On the true/false question page, do not select any answer and click 'Submit'

      Expected:

      • You loop on the page, or silently skip the page

      Actual:

      • Exception is raised
      Debug info: SELECT * FROM {lesson_answers} WHERE id IS NULL
      [array (
      )]
      Error code: invalidrecord
      Stack trace:
      line 1321 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 85 of /mod/lesson/pagetypes/truefalse.php: call to moodle_database->get_record()
      line 1922 of /mod/lesson/locallib.php: call to lesson_page_type_truefalse->check_answer()
      line 79 of /mod/lesson/continue.php: call to lesson_page->record_attempt()
      
      Output buffer: Notice: Undefined property: stdClass::$answerid in /home/fred/www/repositories/testing_23/moodle/mod/lesson/pagetypes/truefalse.php on line 79 Call Stack: 0.0015 781592 1. {main}() /home/fred/www/repositories/testing_23/moodle/mod/lesson/continue.php:0 0.3289 51681816 2. lesson_page->record_attempt() /home/fred/www/repositories/testing_23/moodle/mod/lesson/continue.php:79 0.3289 51681816 3. lesson_page_type_truefalse->check_answer() /home/fred/www/repositories/testing_23/moodle/mod/lesson/locallib.php:1922
      

        Issue Links

          Activity

          Hide
          Rossiani Wijaya added a comment -

          This looks great Fred.

          Thank you.

          Show
          Rossiani Wijaya added a comment - This looks great Fred. Thank you.
          Hide
          Dan Poltawski added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          Dan Poltawski added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          Dan Poltawski added a comment -

          Integrated, thanks Fred.

          Show
          Dan Poltawski added a comment - Integrated, thanks Fred.
          Hide
          Ankit Agarwal added a comment -

          This works as expected!
          Passing.
          Thanks

          Show
          Ankit Agarwal added a comment - This works as expected! Passing. Thanks
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Fixed STOP Closed STOP Thanks STOP

          Yay, imagination! Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Fixed STOP Closed STOP Thanks STOP Yay, imagination! Ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved: