A bug with the "short-answer" question type in Jquiz

A bug with the "short-answer" question type in Jquiz

by C P -
Number of replies: 17

Hi everyone,

I have a problem with my first HotPot test on Moodle.

I made a test including 40 questions, 2 of them are short-answer type.
When I import it on Moodle with the HotPot module, the test is empty...
When I delete these 2 questions, it works...

Do you have any hint ?

Thanks in advance !

 

Chris

Average of ratings: -
In reply to C P

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Chris,

please could you upload the JQuiz to my server so we can look at it together there:

thanks
Gordon

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

Ok done, the test is named : "Jquiz - Christophe Pons" on your server.

In reply to C P

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Thank you.

It is the apostrophe's that are causing problems. For example, this one:

If you gave me a day or two, I will fix the HotPot code and let you know when it is fixed.

Average of ratings: Useful (1)
In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

Indeed, it worked without the apostrophe's. I deleted it on all questions, not only on the two short-answer type.

Hum there is something strange anyway.
When I place the two short-answer questions on the first places, it works even with the apostrophe's, why ? That's a little bit weird...

Why isn't it working only when these two questions are there ?

 

Thanks

In reply to C P

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Slow down with the questions please wink

I have fixed the cause of the issue, so that the HotPot module can handle apostrophe's in strings that get inserted into JavaScript.

I am just arranging for the new scripts to be added to the Moodle CVS. That should be finished very soon, then sometime within the next 24 hours the new scripts will be available from the Moodle downloads page.

thanks for reporting this issue, and for your patience while I was getting it fixed.

regards
Gordon

Average of ratings: Useful (1)
In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

Thanks a lot Gordon !

Regards
Chris

In reply to C P

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

You're welcome !

If have updated the Moodle CVS for Moodle 1.9, so that will be available from the Moodle downloads page in due course - usually less than 24 hours.

If you are in a great hurry, you can download the modified HotPot module for Moodle 1,9 from my server:

I will update Moodle 1.6, 1.7, 1.8 and 2.0 when I get time.

enjoy!
Gordon

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

I have just finished updating the HotPot scripts in the CVS repositories for Moodle 1.6, 1.7, 1.8 and 2.0, so we should have no more problems with apostrophe's in JavaScript.

However, if you notice anything strange, please feel free to report it here.

best regards
Gorodn

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

OK lets try it !

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

One last thing Gordon.

Why is the HotPot module version still the same ? (2007101513)

In reply to C P

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Christophe,

the version number is still the same because there is was no change to the database structure or content. I only change the version number when it is necessary to trigger the HotPot update scripts to take some action on the database.

If I changed the version number for every little change I make to the HotPot scripts we would soon run out of version numbers wink

best regards
Gordon

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

Indeed. Thanks !

It's working fine by the way !

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

Hi,

Could you be more precise about the fix of the problem ?

The javascript code bugged because of an impair number of apostrophe's ?

Thanks

Chris

In reply to C P

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

> The javascript code bugged because of an impair number of apostrophe's ?

Oh dear. The quiz you gave me to test on was working on my server. Is this the same quiz or a different one? Please could you send me a copy of the quiz that doesn't work?

thanks
Gordon

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

It's the same quiz, it's working fine now.

I just wanted to have some precisions about the fix...? What wasn't working ? (the apostrophe's problem)

Thanks

In reply to C P

Re: A bug with the "short-answer" question type in Jquiz

by Gordon Bateson -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Well, the <enter-a-guess> tag from the ",jqz" file, which is actually an xml file, needs to have it's apostrophe's escaped because it is sent to the browser as a javascript string. The string was not being escaped, so I modifed the appropriate script, line 1464 of "mod/hotpot/template/v6.php" to be precise, and now - viola, it works!

While I was at it, I realized there were some other strings that needed to be escaped for javascript, and I also found a couple of strings that were being esacped that didn't need to be so I fixed them.

For a full inventory of what was changed, please see the Moodle CVS site:

In reply to Gordon Bateson

Re: A bug with the "short-answer" question type in Jquiz

by C P -

Okay ! Ty

Chris