Moodle
  1. Moodle
  2. MDL-22349

Matching question type does not support wrong-only response

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 1.9.8, 2.0
    • Fix Version/s: 2.0.1
    • Component/s: Lesson
    • Labels:
    • Database:
      MySQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      1666

      Description

      If you create a matching question and provide responses for both correct and wrong answers, everything works as expected.

      If you provide a response only for wrong answers, this response (that may e.g. give hints how to correct the answers) is unexpectedly shown when the question is answered correctly.

      The reason is the way responses are extracted from the answers list in continue.php. Although the first two entries are (according to the comment) reserved for the right and wrong answer, they are not simply used for the responses. Instead, there is a search for the first and the second entry in $answers where $answer->response is NULL and $answer->answer ist not NULL. The matching_answer->answer is used as response. Therefore, if you enter only one response in the form, this automatically becomes the response for the "correct" case, even if entered as response for the "wrong" case.

        Issue Links

          Activity

          Hide
          Martin Dougiamas added a comment -

          Reassigning this to moodle.com for the time being, since Mark Nielsen is not maintaining Lesson any more. Please comment/vote/patch any crucial bugs that affect you for 2.0 to help us prioritise fixes for the upcoming release.

          Show
          Martin Dougiamas added a comment - Reassigning this to moodle.com for the time being, since Mark Nielsen is not maintaining Lesson any more. Please comment/vote/patch any crucial bugs that affect you for 2.0 to help us prioritise fixes for the upcoming release.
          Hide
          Petr Škoda added a comment -

          oh, I have already fixed this in 2.0 - actually I have replaced the logic there with a simpler code, works fine now in 2.0
          thanks for the report and patch, I hope somebody who understands the code in 1.9.x will test your fix and apply it ...

          Show
          Petr Škoda added a comment - oh, I have already fixed this in 2.0 - actually I have replaced the logic there with a simpler code, works fine now in 2.0 thanks for the report and patch, I hope somebody who understands the code in 1.9.x will test your fix and apply it ...
          Hide
          Tim Hunt added a comment -

          Updating components.

          Show
          Tim Hunt added a comment - Updating components.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          This issue could be the same / being related with MDL-25632 (Problem 2)

          Show
          Eloy Lafuente (stronk7) added a comment - This issue could be the same / being related with MDL-25632 (Problem 2)
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Moved to stable backlog. Makes reference to 1.9.x, while MDL-25632 describes a problem in 2.0.x. Please review for both branches

          Show
          Eloy Lafuente (stronk7) added a comment - Moved to stable backlog. Makes reference to 1.9.x, while MDL-25632 describes a problem in 2.0.x. Please review for both branches
          Hide
          Sam Hemelryk added a comment -

          Hi guys,

          Michael thanks for the patch, I've created a patch that is pretty much the patch you submitted, I have however dropped the foreach loops in favour or specifically getting the answer from the answers array using reset and next.
          I've created PULL-3 to get the patch reviewed and get it into core.

          Cheers
          Sam

          Show
          Sam Hemelryk added a comment - Hi guys, Michael thanks for the patch, I've created a patch that is pretty much the patch you submitted, I have however dropped the foreach loops in favour or specifically getting the answer from the answers array using reset and next. I've created PULL-3 to get the patch reviewed and get it into core. Cheers Sam
          Hide
          Petr Škoda added a comment -

          closing, thanks

          Show
          Petr Škoda added a comment - closing, thanks
          Hide
          Pasi Häkkinen added a comment -

          Committed patch to MOODLE_19_STABLE does not work in PHP4. (Yes, there are still some RHEL4 users out there...). Michael's patch works fine.

          Show
          Pasi Häkkinen added a comment - Committed patch to MOODLE_19_STABLE does not work in PHP4. (Yes, there are still some RHEL4 users out there...). Michael's patch works fine.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: