Quiz bombs out

Quiz bombs out

by Chris Comer -
Number of replies: 23
<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -->

Occasionally when a student goes to submit a quiz they get a “This page cannot be displayed” error. It was easy enough to fix for the quiz, but in order to allow the student to complete an exam I have to allow more attempts so that they can just finish as opposed to having to retake. This allows more attempts for everybody enrolled in the course.

Is there a way that I can put the student back in the quiz were they left off? Or perhaps is there a way to allow more attempts at the “student” level as opposed to the “quiz” level?

I have inherited this Moodle system from another tech that has moved on and I’m very lost.


I am using version 1.9.2

Average of ratings: -
In reply to Chris Comer

Re: Quiz bombs out

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
What do you mean by 'It was easy enough to fix for the quiz'? What did you do?
In reply to Tim Hunt

Re: Quiz bombs out

by Chris Comer -

I guess fix is the wrong word. What we wind up doing is is allowing another attempt at the quiz. So that if the student previously was allowed 2 attempts they now have 3. They then can log back in and hit submit the quiz.

The problem is that if you change the quiz to allow 3 attempts for one student then it changes it for ALL students. this allows another student to get back in and have another crack that they were not supposed to have.

Chris

In reply to Chris Comer

Re: Quiz bombs out

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
The problem is that it is hard to diagnose the problem further without a proper error message. Are you prepared to run for a while with admin -> server -> debugging turned on, to see if you can get more information about what is failing.
In reply to Tim Hunt

Re: Quiz bombs out

by Chris Comer -
Display debug messagesdebugdisplay is set to yes. All other logging options are currently set to off. The Debug messages is set to none. Is there some other setting that should be turned on? Also where are the debug report / messages put?
Chris
In reply to Chris Comer

Re: Quiz bombs out

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 am suggesting you set Debug messages to ALL temporarily, to try to capture the true error message associated with this problem.

If messagesdebugdisplay is On, debug messages are displayed on screen. If it is Off, they are sent to your PHP log files.
In reply to Tim Hunt

Re: Quiz bombs out

by Chris Comer -
OK I set Debug Messages to all like you said. I unchecked the show on screen option so any errors should write to a log file. I guess I am having a case of the stupids here because I can not find the log file. Any idea where it is located?
In reply to Chris Comer

Re: Quiz bombs out

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'm afraid that the answer depends on how your PHP system is set up. Google may be able to help you, if not, post details of your server system (something like PHP5 + Apache + Ubuntu linux, or PHP4 + IIS + Windows XP) here and someone may know.

Installation_FAQ#How_to_enable_and_check_PHP_error_logs is disappointingly unhelpful - for example, the easiest way to turn on error logging is actually to use the Moodle interface, and that is not even mentioned.
In reply to Tim Hunt

Re: Quiz bombs out

by Chris Comer -
Well it took a while for another error to occur.
This is in her words.

"I had completed all but the last section the exam with 21 minutes to go, hit save without submitting, and lost everything - all I had was a blank screen."

I have found the PHP logs and in looking at around the time she had her error I found this over and over

[01-Dec-2008 08:19:36] PHP Notice: Object of class stdClass could not be converted to int in D:\webs\moodle\question\type\multianswer\questiontype.php on line 271

I looked at that line in that file but I'm no PHP guy.

Any ideas?



In reply to Chris Comer

Re: Quiz bombs out

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
That is quite helpful, but I am failing to match up the line number in the error message with the actual code, probably because of bug fixes.

Could you go into the file question\type\multianswer\questiontype.php and copy and paste the first line here. It should look something like

<?php // $Id: questiontype.php,v 1.41.2.9 2008/06/17 01:11:09 pichetp Exp $

The key part is the v 1.41.2.9 bit.
In reply to Tim Hunt

Re: Quiz bombs out

by Chris Comer -
<?php // $Id: questiontype.php,v 1.41.2.10 2008/06/19 01:46:16 pichetp Exp $

I think that this is the offending code. The selection starts on line 261 according to HTML Kit.

Hope this gets you what you need.

// The regex will recognize text snippets of type {#X}
// where the X can be any text not containg } or white-space characters.

while (ereg('\{#([^[:space:]}]*)}', $qtextremaining, $regs)) {
$qtextsplits = explode($regs[0], $qtextremaining, 2);
echo "<label>"; // MDL-7497
echo $qtextsplits[0];
$qtextremaining = $qtextsplits[1];

$positionkey = $regs[1];
if (isset($question->options->questions[$positionkey]) && $question->options->questions[$positionkey] != ''){
$wrapped = &$question->options->questions[$positionkey];
$answers = &$wrapped->options->answers;
// $correctanswers = $QTYPES[$wrapped->qtype]->get_correct_responses($wrapped, $state);

$inputname = $nameprefix.$positionkey;
if (isset($state->responses[$positionkey])) {
$response = $state->responses[$positionkey];
} else {
$response = null;
}

// Determine feedback popup if any
$popup = '';
$style = '';
$feedbackimg = '';
$feedback = '' ;
$correctanswer = '';
$strfeedbackwrapped = $strfeedback;


Chris
In reply to Chris Comer

Re: Quiz bombs out

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, so in the latest 1.9.3+ version that line of code is now line 27, but has not changed.

We really need Pierre Pichet to join this thread. He is the expert on the multianswer question type.

It might be worth trying the following. Change the line
if (isset($question->options->questions[$positionkey]) && $question->options->questions[$positionkey] != ''){

to

if (!empty($question->options->questions[$positionkey])) 

Take a backup first. But that is a pretty safe change to try.

In reply to Chris Comer

Re: Quiz bombs out

by Pierre Pichet -
[01-Dec-2008 08:19:36] PHP Notice: Object of class stdClass could not be converted to int in D:\webs\moodle\question\type\multianswer\questiontype.php on line 271
This is the problem if the subquestion has been lost somehow.
The code has been "strengthened" in the preceeding version but it seems that this was not sufficient.


Look at the question table and locate the question that have the id that is show if you preview the question
moodle_19/question/preview.php?continue=1&quizid=7&id=7
&id=7 (i.e here question id = 7)
you should find in the question table other questions that have the parent set to your question id value .
These are the subquestions of the multianswer question.



Pierre


In reply to Tim Hunt

Re: Quiz bombs out

by Rob Monk -

We have a similar yet extremely frustrating error. Here is what happens to our teachers.

OK class of 25 students, do your science exam. It is 60 multiple choice questions.

Kids do the exam

Kids finish and hit the "Save All and Submit" button.

On average 1 in 6 students are logged straight out with no error message. When they log back in, all their answers are gone and there is no way to get them back!!! The same thing happens with "Save without submitting"

For 5 out of 6 students it works perfectly!!

The now very grumpy 1 in 6 student repeats the quiz. Sometimes it works perfectly again. Other times it logs them out and they are stuffed and have to do it a third time.

This is really undermining teacher confidence in using moodle.

How do I diagnose this fault?

We are using Moodle 1.9.1+ (Build: 20080625)

PHP Version 5.2.0-8+etch7


In reply to Rob Monk

Re: Quiz bombs out

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Which authentication method are you using?
In reply to Tim Hunt

Re: Quiz bombs out

by Rob Monk -
In reply to Rob Monk

Re: Quiz bombs out

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hmm. I am not an expert on that. However, we had a similar problem at the Open University with our custom authentication system. Students were losing their login session, and even though they were getting automatically re-authenticated, that process of re-establishing their session involved several redirects, which is what caused the data they were submitted to get lost.

I was able to work this out by picking through the web server logs. I could see the redirects. Fortunately our logs were set to record the username and cookies.

If your problem is similar, then it is not actually a quiz-specific problem. The same thing would happen if they were posting to a forum at the time, rather than submitting a quiz. It is just that the usage pattern of someone attempting a quiz means that it is more likely to show up here than in the forum module, and is more annoying when it does.
In reply to Tim Hunt

Re: Quiz bombs out

by Rob Monk -

You seem to be on the right track. We do lose forum posts and journal submissions with a similar annoying frequency as quiz submits. Kids now know to do their forum posts in word first and then post in Moodle or they are a chance to loose it.

OK, web sever logs is a place to look for diagnosis but how do I fix it.

In reply to Rob Monk

Re: Quiz bombs out

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Rob > Kids now know to do their forum posts in word first and then post in Moodle or they are a chance to loose it.

Although I can see your point, I would strongly advise against typing text in MS Word and then copy and paste into the moodle HTML editor. This operation will bring along a lot of unnecessary formatting, which will remain invisible but will be there all the same. This operation is the source of many problems, often mentioned in this Quiz forum, when teachers write their questions in MS Word and then copy-paste that text into the Questions editor in moodle.

On the other hand I would recommend using a very simple text editor (under Windows, Notepad is fine) for preparing a "rough copy" of posts, then copy-paste that rough copy into moodle's HTML editor and then perhaps "beautify" the text using the HTML editor's formatting features.

Again, my advice - based on quite a few years of moodle use - is : never ever do a "copy-paste" from MS Word into Moodle HTML editor.

Joseph

PS.- There is a Clean Word HTML button in moodle's HTML editor toolbar. Forget it does, it does not work correctly.sad

In reply to Tim Hunt

Re: Quiz bombs out

by Rob Monk -

Thanks Tim,

I have kind of ignored this problem but it is still happening. We still have about 3 out of 25 kids whos quizzes don't submit and they have to do them again.

You mentioned.

Students were losing their login session, and even though they were getting automatically re-authenticated, that process of re-establishing their session involved several redirects, which is what caused the data they were submitted to get lost.

I was able to work this out by picking through the web
server logs. I could see the redirects. Fortunately our logs were set to record the username and cookies.

How do I pick though web server logs. Do I look specifically at a student whose test did not submit? How did you actually fix the problem?

In reply to Rob Monk

Re: Quiz bombs out

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well I was lucky becuase the OU's webserver logs had the user name in the log file. So I was able to start by using grep to get just the log lines relating to the user who had the problem.

I was also helped by the fact that they had also turned on the option to save all the cookies in the log file.

So, once I had found the right bit, I could see, roughly:

A. ... "GET .../mod/quiz/attempt.php?id=123" 200 ... OULOGIN=xyz;MOODLESESSION=pqr ...
B. ... "POST .../mod/quiz/attempt.php" 302... OULOGIN=xyz;MOODLESESSION=pqr ...
C. ... "GET .../mod/quiz/attempt.php" 404... OULOGIN=stu;MOODLESESSION=pqr ...

What we are seeing there is:

A. is the student attempting the quiz happily. There are actually several similar lines, each a few seconds apart.

B. is the point where the authentication system decided that the user was no longer correctly logged in, so insted of a 200 OK response, they instead get a redirect to the autentication page. I don't see that, becuase the authenication happens on another server. All I see is ...

C. a few seconds later, the student comes back with a new login cookie. In the process of being redirected to the login page and back, the original POST request has been changed into a GET requset and the post data has been lost. This causes Moodle to report an error (the 404). Notice that the OULOGIN cookie has changed, although the Moodle session is uninterrupted.

Of coures, it took a lot of staring at the data to work that out.
In reply to Chris Comer

Re: Quiz bombs out

by Pierre Pichet -
<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} -
This is a tytpical problem if the teacher that created a multianswer question do a copy and paste from a microsoft word .doc.
This can give non XML text that cannot display correctly.


I remember that I CVS to HEAD 2008/11/29 a little modification to the question text display version 1.76 "Displacing <label> to enclose correctly answer text in question display so no possible XML problem.".
In your version you will find (line 266...)
echo "<label>"; // MDL-7497
echo $qtextsplits[0];
$qtextremaining = $qtextsplits[1];
change this to
echo $qtextsplits[0];
echo "<label>"; // MDL-7497
$qtextremaining = $qtextsplits[1];
so that the response input or select is enclosed between "<label>"...."</label>"


You could also check your moodle administration/server/debugging to no Strict XML.


Pierre

In reply to Pierre Pichet

Re: Quiz bombs out

by Pierre Pichet -
this modification was done 2008/11/24 on 1.9 multianswer/questiontype.php version 1.41.2.13

Pierre Pichet