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

Question type Drag and drop into text undefined notice for gap in question and answer slot

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.6
    • Fix Version/s: None
    • Component/s: Questions
    • Labels:
    • Testing Instructions:
      Hide

      1. Create a course.
      2. Turn editing on.
      3. Add a Quiz activity.
      Name: Quiz_1
      4. Save and display.
      5. Click Edit quiz button.
      6. Click Add a new question link.
      7. Select Drag and drop into text.
      Question name: DDiT
      Question text: The colours [[1]] and [[3]] are primary colours.
      Choice 1 Answer: Yellow
      Choice 2 Answer: [leave this blank/empty]
      Choice 3 Answer: Blue
      8. Click Save changes.
      Result: You will see the following notice:
      Notice: Undefined offset: 3 in [moodledir]/question/type/gapselect/questiontypebase.php on line 166

      Notice: Undefined index: in [moodledir]question/type/gapselect/questionbase.php on line 221

      Warning: Invalid argument supplied for foreach() in [moodledir]question/type/gapselect/questionbase.php on line 221
      9. Preview the question.
      Result: You will see the following notice:
      Notice: Undefined offset: 3 in [moodledir]/question/type/gapselect/questiontypebase.php on line 166

      Notice: Undefined index: in [moodledir]/question/type/gapselect/questionbase.php on line 221

      Warning: Invalid argument supplied for foreach() in [moodledir]/question/type/gapselect/questionbase.php on line 221

      Notice: Undefined index: in [moodledir]/question/type/gapselect/questionbase.php on line 221

      Warning: Invalid argument supplied for foreach() in [moodledir]/question/type/gapselect/questionbase.php on line 221

      You will also see that the first placeholder slot is fine, but the second one is not (as there is no answer matching it).

      10. Update/edit the question.
      Result: You will see the "Blue" which was originally saved in Choice 3 is actually now sitting on Choice 2, which I believe causes the issue.

      Show
      1. Create a course. 2. Turn editing on. 3. Add a Quiz activity. Name: Quiz_1 4. Save and display. 5. Click Edit quiz button. 6. Click Add a new question link. 7. Select Drag and drop into text. Question name: DDiT Question text: The colours [ [1] ] and [ [3] ] are primary colours. Choice 1 Answer: Yellow Choice 2 Answer: [leave this blank/empty] Choice 3 Answer: Blue 8. Click Save changes. Result: You will see the following notice: Notice: Undefined offset: 3 in [moodledir] /question/type/gapselect/questiontypebase.php on line 166 Notice: Undefined index: in [moodledir] question/type/gapselect/questionbase.php on line 221 Warning: Invalid argument supplied for foreach() in [moodledir] question/type/gapselect/questionbase.php on line 221 9. Preview the question. Result: You will see the following notice: Notice: Undefined offset: 3 in [moodledir] /question/type/gapselect/questiontypebase.php on line 166 Notice: Undefined index: in [moodledir] /question/type/gapselect/questionbase.php on line 221 Warning: Invalid argument supplied for foreach() in [moodledir] /question/type/gapselect/questionbase.php on line 221 Notice: Undefined index: in [moodledir] /question/type/gapselect/questionbase.php on line 221 Warning: Invalid argument supplied for foreach() in [moodledir] /question/type/gapselect/questionbase.php on line 221 You will also see that the first placeholder slot is fine, but the second one is not (as there is no answer matching it). 10. Update/edit the question. Result: You will see the "Blue" which was originally saved in Choice 3 is actually now sitting on Choice 2, which I believe causes the issue.
    • Affected Branches:
      MOODLE_36_STABLE

      Description

      In a Drag and Drop Into Text question type, a user can can add question answer slot by accidentally or intentionally leaving a gap. An example of which can be:

      Question name: DDiT
      Question text: The colours [[1]] and [[3]] are primary colours.
      Choice 1 Answer: Yellow
      Choice 2 Answer: [leave this blank/empty]
      Choice 3 Answer: Blue

      When this question is saved. The actual answers saved are only Choice1[Yellow] and Choice2[Blue]. Note that Blue was moved from 3 to 2.

      This causes a mismatch in the slot and answer as the question text still expects [[1]] and [[3]]. 

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated: