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

error in Lesson question shortanswer with regexp option

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.0, 2.1.2
    • 2.0.7, 2.1.4
    • Lesson
    • None
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • MOODLE_20_STABLE, MOODLE_21_STABLE
    • Hide

      #. login as admin/teacher
      #. create a lesson,
      #. set 'Provide option to try a question again' to yes
      #. set 'Display default feedback' to yes
      #. add shortanswer question
      #. tick on 'options' to use regular expression
      #. on answer 1 section, enter the following string: 'it's blue, white(,| and) red/i'
      #. save page
      #. preview the question and answer it with either one of these correct answers: 'it's blue, white, red' or 'it's blue, white and red'

      The above answers should be recognize as the correct answers.

      For more info regarding correct answer with regular expression: http://docs.moodle.org/20/en/Short_answer_analysis

      Show
      #. login as admin/teacher #. create a lesson, #. set 'Provide option to try a question again' to yes #. set 'Display default feedback' to yes #. add shortanswer question #. tick on 'options' to use regular expression #. on answer 1 section, enter the following string: 'it's blue, white(,| and) red/i' #. save page #. preview the question and answer it with either one of these correct answers: 'it's blue, white, red' or 'it's blue, white and red' The above answers should be recognize as the correct answers. For more info regarding correct answer with regular expression: http://docs.moodle.org/20/en/Short_answer_analysis

    Description

      Error in mod/lesson/pagetypes/shortanswer.php line 88

      if (substr($expectedanswer,0,-2) == '/i') {

      should be

      if ( substr($expectedanswer,strlen($expectedanswer) - 2, 2) == '/i') {

      Attachments

        Activity

          People

            rwijaya Rossiani Wijaya
            rezeau Joseph Rézeau
            Adrian Greeve Adrian Greeve
            Sam Hemelryk Sam Hemelryk
            Rajesh Taneja Rajesh Taneja
            Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan
            Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              9/Jan/12