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

Lesson breaks when user does not select an answer

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.4, 2.3.1
    • 2.2.5, 2.3.2
    • Lesson
    • MOODLE_22_STABLE, MOODLE_23_STABLE
    • MOODLE_22_STABLE, MOODLE_23_STABLE
    • MDL-34259-master
    • 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

    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

      Attachments

        Issue Links

          Activity

            People

              fred Frédéric Massart
              fred Frédéric Massart
              Rossiani Wijaya Rossiani Wijaya
              Dan Poltawski Dan Poltawski
              Ankit Agarwal Ankit Agarwal
              Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10/Sep/12