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

Incorrect error thrown when switching to essay question type inside Lessons for certain cases

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.13
    • Fix Version/s: 1.9.15
    • Component/s: Lesson
    • Labels:
    • Database:
      Any
    • Testing Instructions:
      Hide

      1. Create a new lesson
      2. Add a new question page
      3. Title the question 'Essay 1' and click save, "not realizing you just saved a multiple choice question type"
      4. "See you're error" and edit the question.
      5. Switch to the 'essay' type by clicking the last tab
      6. Save the essay and receive the following error: Update page: EOB not updated
      7. Go back to the lesson and see that it really was updated.
      8. Apply the patch, repeat steps 1-6 but find no error.

      Show
      1. Create a new lesson 2. Add a new question page 3. Title the question 'Essay 1' and click save, "not realizing you just saved a multiple choice question type" 4. "See you're error" and edit the question. 5. Switch to the 'essay' type by clicking the last tab 6. Save the essay and receive the following error: Update page: EOB not updated 7. Go back to the lesson and see that it really was updated. 8. Apply the patch, repeat steps 1-6 but find no error.
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Pull from Repository:

      Description

      I realize this is an edge case scenario but we had to address it here due to repeated run-ins with it.
      If a Lesson creator Adds a new Question Page with a MultipleChoice question (the default question type when creating a new question) and clicks save without adding any answers, they will get an incorrect error if they then choose to go back, edit that question, and save it as an essay.

      The error they get is "Update page: EOB not updated". This is not correct. The page updates correctly. The code assumes that it wasn't because update_record() returns false. It returns false because its being told to update a record with and id of 0.

      Testing instructions and forthcoming patch will give more explanation.

        Gliffy Diagrams

          Activity

          Hide
          blepoxp Glenn Ansley added a comment -

          Tested in Moodle 2.1 and this was not an issue as you are 1) Asked what type of question you want before giving it any attributes and 2) If you accidentally select multichoice like in the example above, you are required to provide at least 1 answer.

          Show
          blepoxp Glenn Ansley added a comment - Tested in Moodle 2.1 and this was not an issue as you are 1) Asked what type of question you want before giving it any attributes and 2) If you accidentally select multichoice like in the example above, you are required to provide at least 1 answer.
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Hi Glenn,

          The changes look sensible, thanks for testing in other branches as well.
          I'm going to put this up for integration now so that it gets properly looked at on Monday. Feel free to take it out (reopen) if you are still wanting to work on it.

          Cheers
          Sam

          Show
          samhemelryk Sam Hemelryk added a comment - Hi Glenn, The changes look sensible, thanks for testing in other branches as well. I'm going to put this up for integration now so that it gets properly looked at on Monday. Feel free to take it out (reopen) if you are still wanting to work on it. Cheers Sam
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Thanks Glenn - this has been integrated now

          Show
          samhemelryk Sam Hemelryk added a comment - Thanks Glenn - this has been integrated now
          Hide
          rwijaya Rossiani Wijaya added a comment -

          This is working great.

          Test passed.

          Show
          rwijaya Rossiani Wijaya added a comment - This is working great. Test passed.
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Many thanks for all the hard work. This is now part of Moodle, your favorite LMS.

          Closing as fixed, ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Many thanks for all the hard work. This is now part of Moodle, your favorite LMS. Closing as fixed, ciao

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                28/Nov/11