Moodle
  1. Moodle
  2. MDL-26281

apostrophe not recognized in lesson shortanswer question

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1
    • Fix Version/s: 2.0.4
    • Component/s: Lesson
    • Labels:
    • Testing Instructions:
      Hide

      1. Create a lesson activity
      2. Add short answer type question.
      3. Put answer as "

      {<It work's well! :)>}

      ". Try use all html special chars to make sure answer is compared for all.

      Show
      1. Create a lesson activity 2. Add short answer type question. 3. Put answer as " {<It work's well! :)>} ". Try use all html special chars to make sure answer is compared for all.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Pull Master Branch:
      wip-mdl-26281-master
    • Rank:
      15887

      Description

      apostrophe not recognized in lesson shortanswer question
      see http://moodle.org/mod/forum/discuss.php?d=168052

      easy fix:
      in file lesson/pagetypes/shortanswer.php
      around line 80
      replace:
      foreach ($answers as $answer) {
      $i++;
      $expectedanswer = $answer->answer; // for easier handling of $answer->answer

      with

      foreach ($answers as $answer) {
      $i++;
      $expectedanswer = s($answer->answer); // for easier handling of $answer->answer

        Issue Links

          Activity

          Hide
          Joseph Rézeau added a comment -

          BUMP !
          My easy fix has still not been applied...

          Show
          Joseph Rézeau added a comment - BUMP ! My easy fix has still not been applied...
          Hide
          Michael de Raadt added a comment -

          Increasing priority as this is the cause of a failed QA test.

          Show
          Michael de Raadt added a comment - Increasing priority as this is the cause of a failed QA test.
          Hide
          Rajesh Taneja added a comment -

          User input was being modified before comparison. Now quotes are being added at the output.

          Show
          Rajesh Taneja added a comment - User input was being modified before comparison. Now quotes are being added at the output.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Uhm...

          looking for uses to that check_answer() method... it seems that it's used in this way:

          1) $result->studentanswer is sent to ouput
          2) $result->userresponse is sent to DB

          So, IMO, we should be doing the cleaning right before output and not @ check_answer() at all.

          Also, really fun... this line, hehe:

          $studentanswer = $studentanswer;
          

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Uhm... looking for uses to that check_answer() method... it seems that it's used in this way: 1) $result->studentanswer is sent to ouput 2) $result->userresponse is sent to DB So, IMO, we should be doing the cleaning right before output and not @ check_answer() at all. Also, really fun... this line, hehe: $studentanswer = $studentanswer; Ciao
          Hide
          Rajesh Taneja added a comment -

          Removed redundant studentanswer assignment and now studentanswer is cleaned for $result->studentanswer only.

          Show
          Rajesh Taneja added a comment - Removed redundant studentanswer assignment and now studentanswer is cleaned for $result->studentanswer only.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Great, thanks! This has been integrated!

          Show
          Eloy Lafuente (stronk7) added a comment - Great, thanks! This has been integrated!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Passing test without further action. This will be tested by MDLQA-1016 once this meets upstream.

          Show
          Eloy Lafuente (stronk7) added a comment - Passing test without further action. This will be tested by MDLQA-1016 once this meets upstream.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          All git & cvs servers have been updated with these cool changes, so closing, many thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - All git & cvs servers have been updated with these cool changes, so closing, many thanks!

            People

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

              Dates

              • Created:
                Updated:
                Resolved: