Issue Details (XML | Word | Printable)

Key: MDL-6849
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Jean-Michel Vedrine
Reporter: Tom Trueluk
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

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

Created: 05/Oct/06 11:03 PM   Updated: 22/Sep/07 04:37 AM
Component/s: Questions, Quiz
Affects Version/s: 1.6.2
Fix Version/s: 1.7.2

Participants: Jean-Michel Vedrine and Tom Trueluk
Security Level: None
Resolved date: 22/Sep/07
Affected Branches: MOODLE_16_STABLE
Fixed Branches: MOODLE_17_STABLE


 Description  « Hide
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.



 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Jean-Michel Vedrine added a comment - 22/Sep/07 04:35 AM
This bug was in fact caused by the fact that when this questiontype was updated for Moodle 1.6 in some places of the code the tables name was not changed from quiz_ to question_. This has been corrected a few months ago and the actual code in contrib/plugins/question/type/renderedmatch CVS works with Moodle 1.6, 1.7 and 1.8 (and is in the process of been adapted to Moodle 1.9 too)

Jean-Michel Vedrine added a comment - 22/Sep/07 04:37 AM
Closing this issue because it is now fixed