Problems with matching question type after upgrade to 1.9.3+

Problems with matching question type after upgrade to 1.9.3+

by Shauna Karren -
Number of replies: 9

I like using matching questions in quizzes. After upgrading to 1.9.3+ this week, my existing matching questions (as well as new ones I write) are not behaving as they should.

I still see the following when writing/editing a question:

"Available choices:

You must provide at least two questions and three answers. You can provide extra wrong answers by giving an answer with a blank question. Entries where both the question and the answer are blank will be ignored."


But when I provide extra wrong answers the student sees an extra line in the quiz question. The "question" portion is blank but there is an answer box lined up with the other answer boxes. (see attached screen shot)


When the question is graded, the student is marked down for not answering all of the questions.


Has anyone else experienced this? Have I inadvertently changed a setting?


Thanks in advance for any help!

Attachment Example_Matching_Question.jpg
Average of ratings: -
In reply to Shauna Karren

Re: Problems with matching question type after upgrade to 1.9.3+

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I have just tested, and the matching question type is working fine for me in the latest Moodle 1.9.3+
In reply to Tim Hunt

Re: Problems with matching question type after upgrade to 1.9.3+

by trent cameron -
Same problem as skarren I thought I would give you more info. We are running Microsofts SQL server. when I look at the table I see

SELECT id, code, question, questiontext, answertext
FROM mdl_question_match_sub
WHERE (question = 613)

66 716674804 613 hydrant water
67 56793213 613 rain gutter sewer
68 614074707 613 solid waste trash
69 154632569 613 drainage sewer
70 934814453 613 irrigation water
71 646514892 613 dumpster trash
144 878326416 613 garbage trash
145 536193848 613 stormwater sewer
146 540618896 613 fire water
147 382324219 613
internet
148 300079346 613
shower stall
149 69763184 613
laundry
150 12176514 613 sprinkler water
NULL NULL NULL NULL NULL


but the Display looks like skarrens. I was wondering if this had to do with the way mssql returned and empty string or if this should be set to some other value.


In reply to trent cameron

Re: Problems with matching question type after upgrade to 1.9.3+

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Looking through the history, the change that caused this is almost certainly my bug fix for MDL-14420 on 11th December. That was to make it possible to user '0' as a question stem. For example if you wanted to make a question in a language exam like
0 - Zero
1 - Un
2 - Deux
...

And the new code certainly works for me using Postgres, and I sure it must work on MySQL, or we would have heard about it by now. Anyway, I have created MDL-17981 to track this.

So something that happens with MSSQL must be interacting badly with my changes, but I don't have an easy way to test this. (I know, we should have an SQL server database setup at Moodle HQ. It is on our todo list.)

The key lines of code now read (for example line 194).
 if ($subquestion->questiontext !== '') {
I suppose the thing is to find out what $subquestion->questiontext looks like after it has been loaded from a MSSQL database.

Could you (on a test server) Try adding the line of code
print_object($subquestion);
just above the line I mentioned above. Then, when you go to a matching question, you will see lots of junk on screen. It would be great if someone could copy that on-screen junk into the tracker issue (MDL-17981). Ideally, create a test question with some tricky questions and answers like '' and '0' to really test it. Thanks.
In reply to Tim Hunt

Re: Problems with matching question type after upgrade to 1.9.3+

by Luis de Vasconcelos -
Picture of Particularly helpful Moodlers

I've tried it on Moodle 1.9.3+ (Build: 20090121) (2007101533.02) with MSSQL 2005 and I can't reproduce the problem. Everything seems to work fine here.

Attachment xx.JPG
In reply to Tim Hunt

Re: Problems with matching question type after upgrade to 1.9.3+

by trent cameron -
Thanks for looking at this ...
I will try to give you as much detail as possible I know how much fun these things can be to debug we are currently running release = '1.9.3+ (Build: 20081231)'
here is a screenshot of the question I entered
enterquestionpm3.png
and another screen shot of what that looks like when that question is displayed



And the objects printed when we added the print code

[code] => 360595703
 [question] => 795
 [questiontext] => 1
 [answertext] => one
 [id] => 252
 [options] => stdClass Object
 (
 [answers] => Array
 (
 [360595703] => stdClass Object
 (
 [id] => 360595703
 [answer] => one
 [fraction] => 1
 )

 )

 )

)
stdClass Object
(
 [code] => 37719727
 [question] => 795
 [questiontext] =>
 [answertext] => 5
 [id] => 256
 [options] => stdClass Object
 (
 [answers] => Array
 (
 [37719727] => stdClass Object
 (
 [id] => 37719727
 [answer] => 5
 [fraction] => 1
 )

 )

 )

)
stdClass Object
(
 [code] => 329315186
 [question] => 795
 [questiontext] =>
 [answertext] => 4
 [id] => 255
 [options] => stdClass Object
 (
 [answers] => Array
 (
 [329315186] => stdClass Object
 (
 [id] => 329315186
 [answer] => 4
 [fraction] => 1
 )

 )

 )

)
stdClass Object
(
 [code] => 158538819
 [question] => 795
 [questiontext] => 0
 [answertext] => Zero
 [id] => 251
 [options] => stdClass Object
 (
 [answers] => Array
 (
 [158538819] => stdClass Object
 (
 [id] => 158538819
 [answer] => Zero
 [fraction] => 1
 )

 )

 )

)
stdClass Object
(
 [code] => 56671143
 [question] => 795
 [questiontext] => 2
 [answertext] => two
 [id] => 253
 [options] => stdClass Object
 (
 [answers] => Array
 (
 [56671143] => stdClass Object
 (
 [id] => 56671143
 [answer] => two
 [fraction] => 1
 )

 )

 )

)
stdClass Object
(
 [code] => 163269043
 [question] => 795
 [questiontext] =>
 [answertext] => 3
 [id] => 254
 [options] => stdClass Object
 (
 [answers] => Array
 (
 [163269043] => stdClass Object
 (
 [id] => 163269043
 [answer] => 3
 [fraction] => 1
 )

 )

 )

)






In reply to trent cameron

Re: Problems with matching question type after upgrade to 1.9.3+

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Great thanks for doing that.

Unfortunately, PHP's output here is too vague to be helpful. I should have thought of this before. Would it be possible for you to try again, but this time with the debugging line changed to
echo '<pre class="notifytiny">'; var_dump($subquestion->questiontext, $subquestion->answertext); echo '</pre>';
Thanks.
In reply to Tim Hunt

Re: Problems with matching question type after upgrade to 1.9.3+

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
OK, I think I have fixed this now, but it needs someone with MS SQL Server to test it for me. Please use the attached question/type/match/questiontype.php. Or grab the diff crom the Version Control tab of MDL-17981.
In reply to Tim Hunt

Re: Problems with matching question type after upgrade to 1.9.3+

by trent cameron -
This is working great thanks so much for your help in resolving the issue we really appreciate it.
-Trent
In reply to trent cameron

Re: Problems with matching question type after upgrade to 1.9.3+

by Jason Lea -
I've bin looking for that code for ages..
What php file is it?
My dropdown boxes get extended when a long answer is added.
Need to set the width of the <select>

smile