Cloze question problems

Cloze question problems

by Lisa McIver -
Number of replies: 20

Having just upgraded to Moodle 2.5 we've had a few reports of issues with the cloze question - personally I'm not convinced that this wasn't also an issue in our earlier 2.2 install but I'm unable to confirm this one way or another.

A team of academics are using cloze questions widely (as part of a language course).  They have some questions however that don't display the right answer in the feedback.  They also have another problem where a correct answer isn't being registered as such by the quiz.  Our developer thinks the two things may be related.


An example is as follows:

The question asks the student to recount an order number (regardless of case and allowing for a space to be included/or not included - depending on how the student adds it) - the syntax used is:

The order number is:  {1:SHORTANSWER:=9934AKSN~=9934 AKSN}

This looks fine to my inexperienced eye, but when a student enters the correct answer (either with or without the space), this question doesn't recognise it as correct (and neither does it provide the correct answer in the feedback).

Incidentally, our developer has also tried this out in his local installation of Moodle and it's worked just fine - so it looks like it's just our live install that is showing this behaviour.

Does anyone have any suggestions as to what the issue might be?

Average of ratings: -
In reply to Lisa McIver

Re: Cloze question problems

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I created a new cloze question in 2.5 and copy and pasted your code from above and the question worked at expected.  Could it be that the case setting is not applying?  Have you tried it every way?  Do you ever get a correct answer?

In reply to Emma Richardson

Re: Cloze question problems

by Lisa McIver -

Hi Emma

Thanks for taking a look at it.

Yes, we've tried every which way - it doesn't seem to make any difference.  Until of course we put it on a local install of Moodle in which case it works fine. 

The people who have put the quizzes together have around a third of their questions with this problem - as far as I can tell, the ones that aren't being marked correctly are the ones that aren't showing the feedback correctly either.

 

 

 

 

In reply to Lisa McIver

Re: Cloze question problems

by Jean-Michel Védrine -

Hello Lisa,

Could it be that teachers have used a word processor (Word for instance) and copied/pasted into Moodle so the question has a lot of (hidden) garbage in it that is breaking it ? The fact that when we copy your text and paste it into a new question it is working seems to support this idea.

To be sure, open one of the question in the editor and click on the HTML button to see if there are any strange tags in it.

If not, the only way for us to understand the problem would be to do an XML export of a category with some of these questions (of course if there is no confidentiality problem).

In reply to Jean-Michel Védrine

Re: Cloze question problems

by Lisa McIver -

Hi Jean Michel

No, that's not the case - and since I originally posted about the issue, other people in our institution have started to report the same issues as well.

Whatever the issue, it's across our institution and (as far as I know) only related to cloze questions.  Like I say, these questions seem to work on our developers local installs - it's just our live server that seems to throw up the problem.

The questions that we've investigated most thoroughly (in terms of their having appropriate syntax) are confidential I'm afraid.  That said, I had another report of issues this morning (so am attaching a couple of their questions) - at first glance, I think most of the syntax looks OK, but you'll see the screen shot shows correct answers being marked as incorrect. 

Additionally, when you look at the floating yellow box that should show the correct answer, it's missing (this seems to be the case for all the questions that are marked incorrectly).

Many thanks for your help.

 

 

 

 

 

Attachment Screen shot.png
In reply to Lisa McIver

Re: Cloze question problems

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

If the same exact questions are working on a test server and not on your live server, I would suspect something wrong with the install.  How did these questions get on your live server - were they imported or created locally?  If you create the same questions locally on the server, do they work correctly?  Can you post a screenshot of the actual question edit page on the server?

In reply to Emma Richardson

Re: Cloze question problems

by Lisa McIver -

Hi Emma

I'm told by the quiz owner that these questions were created many versions ago but directly in Moodle - I'm also told that they worked in Moodle 2.2.

I've recreated one of the questions by hand in a different course on the same server and have had exactly the same issue (in the exact same places).

I'd agree with you that it's to do with the install (or something that is interfering with it), but we are currently stumped as to what it is  sad

 

 

 

Attachment html editor.png
Attachment question.png
In reply to Lisa McIver

Re: Cloze question problems

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

And you did look at the html version?

I presume your development servers are running the same version of Moodle?

Can you upgrade you live server to the latest version - maybe that would resolve this.  Or maybe just recopy over the multianswer question type folder and check permissions/ownership...

In reply to Emma Richardson

Re: Cloze question problems

by Lisa McIver -

Yep - the HTML looks fine to me (there should have been a screen shot in the previous post - apologies it looks like it went AWOL - I've added it below!)

Both the live server and the test server are running Moodle 2.5 (we've just upgraded our live install from Moodle 2.2).  The quizzes were working fine in Moodle 2.2

I don't know if this is relevant, however the live and test servers are (unfortunately) running different versions of php (I'd have to check on Monday what the versions are) and our IT Dept have also installed APC on the live server (and this isn't on our test install).

I'm not sure if either of these things could cause the strange behaviour or if there is some other (as yet unidentified!) difference.  Our developers have been looking into it, but they are currently at a loss.

 

 

Attachment html editor.png
In reply to Lisa McIver

Re: Cloze question problems

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

That shouldn't affect it at all - I run apc on my server and have not seen any issues.  I think it must be to do with your upgrade - something must have corrupted somewhere.  Unless Jean Michel (he really is one of the true quiz gurus!) has other suggestions, I think you are going to have to reinstall or upgrade.  I guess you could try a database repair maybe ... 

In reply to Emma Richardson

Re: Cloze question problems

by Lisa McIver -

<Eek! >

Really hoping we can find a solution that doesn't involve reinstalling or upgrading - we upgraded over 6200 courses at the beginning of the month so this would be a nightmare (particularly since the new academic year is just around the corner!)

...If by some miracle we find out what is going on I will make sure and post it back to this forum.

 

In reply to Lisa McIver

Re: Cloze question problems

by Toni Soto -

What a weird issue Lisa,

I imported your cloze questions into my moodle 2.5.1 and they worked as it was expected. I'm not an expert but I'd suggest to:

a.- Check in your database (I searched for '%Jessop 1965%') if these questions are recorded as you can see them from the HTML Quiz editor. You should have a look at:

  • mdl_question
  • mdl_question_attempts

b.- What it sounds me really weird is that if you create manually the question in another course it gives you the SAME error at the same WORDS. I wont't discard that this could be caused by APC or any kind of caching issue, but as I said before I'm not an expert. 

Anyway Lisa, let us know how do you solve this please.

Good luck!

Toni

In reply to Toni Soto

Re: Cloze question problems

by Lisa McIver -

Thanks Toni - I'll pass the suggestion on to our developers and will definitely let everyone know if we manage to get to the bottom of this issue!

 

In reply to Lisa McIver

Re: Cloze question problems

by Jean-Michel Védrine -

Hello Lisa,

I must admit that I am completely puzzled by this problem sad

As other people, if I import your xml file, everything is working fine on my test install of Moodle 2.5

Could one of the files on the server be corrupted ? But then why does it affect only certain cloze questions ? Anyway, your developers could try to transfert again a fresh copy of the files in the question subfolder of he server. If they use the exact same version it should not cause any trouble.

Another thing to try would be to purge all caches because in Moodle 2.5 quesions definitions are cached. Go to Site Administration -> Development -> Purge all caches and click on purge all caches. Apart the fact your website will be slower until all data are cached again i should not cause any issue.

In reply to Jean-Michel Védrine

Re: Cloze question problems

by Hittesh Ahuja -

Hi Jean,

I am one of the developers for the university. 

Just wanted to know what do you mean when you say 

Anyway, your developers could try to transfert again a fresh copy of the files in the question subfolder of he server. If they use the exact same version it should not cause any trouble.

 

We have purged all caches a couple of times in the last two weeks and that hasnt changed anything on the live server as far as the problematic cloze quizzes are concerned. 

I have turned off APC on our Live Server as of now to see if that changes anything. Also our live server uses php 5.4.14 and our test server uses PHP 5.3 . One of my local box uses Debian's php 5.4.16, but even there, the quiz seems to behave fine. 

Many thanks,

Hittesh Ahuja

In reply to Hittesh Ahuja

Re: Cloze question problems

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

As I mentioned before, you can just copy over a fresh copy of the question type folder from a Moodle install file.  Make sure it is the same version that you are using and then of course make sure ownership and permissions are correct.

In reply to Emma Richardson

Re: Cloze question problems

by Hittesh Ahuja -

Hi Emma,

Thanks for the clarification.

I dont think files are the issue. We are using the exact same version of files on our live and test server. As it was quicker, I copied the files from the live server into my local box and it still works fine. 

I was looking at the mdl_question_answers table. Should there be an entry for the answers in that table. Something like :

285947 137395 communication 0 1.0000000 Correct 1

Where communication is the correct answer that is shown in the feedback box.

In reply to Hittesh Ahuja

Re: Cloze question problems

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Yes, I believe so.  I am presuming there is not...in which case we are now looking at a database issue?  I am still perplexed as to why just certain answers within the question are working and others not.  Makes me wonder about those particular words.  What happens if you create a totally different question but use those same words for the fill in or maybe use them in a dropdown?  Do the same exact words cause the problem?  In which case, could we be looking at a language setting that might have an override for those particular words?

In reply to Emma Richardson

Re: Cloze question problems

by Hittesh Ahuja -

 What happens if you create a totally different question but use those same words for the fill in or maybe use them in a dropdown? 

Thats a good suggestion . Will try that.

We upgraded out test server to match the live server and now I see the same happening in our test server as well ( both use php 5.4.14) whereas my local box uses php 5.4.17.

One discepancy i found between the live and my local box is that preg_match does not behave the same on both servers.

For example, when the answer reaches this function : compare_string_with_wildcard() in /type/shortanswer/question.php 

the preg_match() result in my local box returns int(1) which suggests that both my regular expression and my answer match whereas on the test server( same as live now) returns int(0) which says that it doesnt match. Both have the exact same regular expression variable and answer variable but return different results.

 

Example : 

Regular expression : |^hitteshahuja@gmail\.com$|ui

Subject : hitteshahuja@gmail.com 

returns int(0) on my test server

while the same expression returns int(1) on my local box.

I'm more inclined to say its different the PHP version ( possibly PCRE module?!) but I cant seem to find anything out there as a bug to very this . 

In reply to Hittesh Ahuja

Re: Cloze question problems

by Hittesh Ahuja -

This did the trick for me. Now I know the 'how' for the fix, still investigating on the 'why' /

 

Under compare_string_with_wildcard() ,

the $regex variable is set to $regexp = '|^' . implode('.*', $escapedbits) . '$|u';

I have removed the u from the end, which i believe is it do with utf-8 (http://php.net/manual/en/reference.pcre.pattern.modifiers.php) and my regular expressions match!!

Average of ratings: Useful (1)
In reply to Hittesh Ahuja

Re: Cloze question problems

by Hittesh Ahuja -

Although this seems like a very good workable solution for now, can anyone tell me why this could be happening? It works great on my local server ( with the 'u' modifier) but i need to remove it to make it work on my live server. 

Please find below a snippet of my phpinfo from my live and local server :

 

PhpInfo comparison between Live and Local Server
 PHP Version  5.4.14 5.4.17-1~dotdeb.0 
 Install   compiled  using apt on Debian
 intl

 version : 1.1.0

ICU version : 4.8.1.1

ICU Data version : 4.8.1

version : PECL-3.0.0

ICU version : 4.4.1

ICU Data version : 4.4.0.1

 mbstring  Multibyte regex (oniguruma) version : 4.7.1  Multibyte regex (oniguruma) version :5.9.1 

2nd column is the live server and the last is my local server built on Debian.

Both the live and local DB has charset set to UTF-8 . 

 

Many thanks,

 

Hittesh