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

Unable to use embedded answers (cloze) question type for quiz activity

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Duplicate
    • Affects Version/s: 2.1
    • Fix Version/s: None
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      LAMP, 2.1+
    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Go to Settings block > Course admin > Questions
      Create a new question > Embedded answers (cloze)
      Use the following sample question syntax.

      Match the following cities with the correct state:

      • San Francisco: {1:MULTICHOICE:=California#OK~Arizona#Wrong}
      • Tucson: {1:MULTICHOICE:California#Wrong~%100%Arizona#OK}
      • Los Angeles: {1:MULTICHOICE:=California#OK~Arizona#Wrong}
      • Phoenix: {1:MULTICHOICE:%0%California#Wrong~=Arizona#OK}

        The capital of France is

        {1:SHORTANSWER:%100%Paris#Congratulations! ~%50%Marseille#No, that is the second largest city in France (after Paris).~*#Wrong answer. The capital of France is Paris, of course.}

        .

      Show
      Go to Settings block > Course admin > Questions Create a new question > Embedded answers (cloze) Use the following sample question syntax. Match the following cities with the correct state: San Francisco: {1:MULTICHOICE:=California#OK~Arizona#Wrong} Tucson: {1:MULTICHOICE:California#Wrong~%100%Arizona#OK} Los Angeles: {1:MULTICHOICE:=California#OK~Arizona#Wrong} Phoenix: {1:MULTICHOICE:%0%California#Wrong~=Arizona#OK} The capital of France is {1:SHORTANSWER:%100%Paris#Congratulations! ~%50%Marseille#No, that is the second largest city in France (after Paris).~*#Wrong answer. The capital of France is Paris, of course.} .
    • Affected Branches:
      MOODLE_21_STABLE

      Description

      Im getting the following debug information when attempting to create an embedded answers (cloze) question type for quiz activity.

      Error writing to database

      More information about this error

      Debug info: Incorrect integer value: 'C' for column 'answerformat' at row 1
      UPDATE mdl_question_answers SET question = ?,answer = ?,feedback = ?,answerformat = ?,fraction = ?,feedbackformat = ? WHERE id=?
      [array (
      0 => 16,
      1 => 'C',
      2 => 'OK',
      3 => 'C',
      4 => '1',
      5 => '1',
      6 => 21,
      )]
      Stack trace:
      line 396 of /lib/dml/moodle_database.php: dml_write_exception thrown
      line 984 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      line 1016 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->update_record_raw()
      line 92 of /question/type/multichoice/questiontype.php: call to mysqli_native_moodle_database->update_record()
      line 424 of /question/type/questiontypebase.php: call to qtype_multichoice->save_question_options()
      line 139 of /question/type/multianswer/questiontype.php: call to question_type->save_question()
      line 424 of /question/type/questiontypebase.php: call to qtype_multianswer->save_question_options()
      line 181 of /question/type/multianswer/questiontype.php: call to question_type->save_question()
      line 264 of /question/question.php: call to qtype_multianswer->save_question()

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                timhunt Tim Hunt
                Reporter:
                chadsta Chad Outten
                Participants:
                Component watchers:
                Tim Hunt, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: