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

The subquestions and subanswers in the Renderedmatch question type don't show up when you try to edit them!!!!

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.2
    • Fix Version/s: 1.7.2
    • Component/s: Questions, Quiz
    • Labels:
      None
    • Affected Branches:
      MOODLE_16_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE

      Description

      When you are editing a quiz, well editing a question in a quiz, and the question is a renderedmatch question the subquestions and subanswers don't show up in the text field. The implementation of question/question.php gets data from teh question table, but doesn't take data from the question_renderedmatch_sub table, which is where the subquestions and subanswers are stored. I have fixed this by adding code at line 55 in question/question.php . In the "if($id)" branch
      right after $qtype=$question->qtype I have added this code:

      $qtype = $question->qtype;

      /beginning of new code/
      if($qtype=="renderedmatch")
      {
      if (! $subs = get_records("question_renderedmatch_sub", "question", $id))

      { error("This question doesn't exist"); }

      foreach($subs as $subquestion)

      { $subquestions[]=$subquestion->questiontext; $subanswers[]=$subquestion->answertext; }

      }
      /end of new code/

      The variables are named subquestion[] and subanswers[] since question/type/renderedmatch/editsubquestion.php trys to insert $subquestion[$i] and $subanswer[$i] into the text fields, and it only needs teh questiontext and the answertext. When you edit these questions though I still thought something would need to be added to ensure that the sub(questions and answers) were changed in the database, but after testing the database is changed. So it would appear that $question = $QTYPES[$qtype]->save_question($question, $form, $course); saves the renderedmatch sub information. If this is the case then this code should be fine.

        Attachments

          Activity

            People

            Assignee:
            jmvedrine Jean-Michel Vedrine
            Reporter:
            tomtrueluk Tom Trueluk
            Participants:
            Component watchers:
            Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Tim Hunt, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              30/Mar/07