Lesson

 
 
Picture of Joseph Rézeau
missing student answer in numerical question report
Group DevelopersGroup Particularly helpful MoodlersGroup TestersGroup Translators
Hi!
Tested with latest 1.5.3STABLE and 1.6DEV versions.
There is a bug in the report view of numerical questions in the lesson module. When viewing an individual student's answers, the student's actual answer and credit received is only displayed under the following conditions: the lesson is set as Custom scoring, and the student's answer was correct (case b). In all other cases, that information is not displayed (see case a).

case a:

Numerical: numbersClass statistics
Question:

When was Larkin born?


Answer:

case b:

Numerical: numbersClass statistics
Question:

When was Larkin born?


Answer:
100% entered this.
Response:
Quite correct! he was born in 1922.

Points earned: 1

However, when viewing detailed statistics we do see the individual answers and the class statistices, regardless of the settings mentioned above.

case c:

Numerical: numbersClass statistics
Question:

When was Larkin born?


Answer:
50% entered this.
50% entered this.
I've identified the bug and I provide a correction here. In version 1.5.3stable, in file \moodle\mod\lesson\action\continue.php around line 500, move line
$answerid = $answer->id;
from where it is shown in red to where it is shown in blue below:
/// CDC-FLAG ///
if ($lesson->custom) {
   if ($answer->score > 0) {
     $correctanswer = true;
     $answerid = $answer->id;
   } else {
$correctanswer = false;
}
}
/// CDC-FLAG ///
break;
}
}
$answerid = $answer->id;
if ($correctanswer) {...

Can anyone please replicate the bug before I post a bug report?
Thanks
Joseph

 
Average of ratings: -
Picture of Joseph Rézeau
Re: missing student answer in numerical question report
Group DevelopersGroup Particularly helpful MoodlersGroup TestersGroup Translators
Up!
Can someone please confirm this bug before I post a bug report?
thanks

Joseph
 
Average of ratings: -
Mark Nielsen in Prague, Czech Republic - 2006
Re: missing student answer in numerical question report
Group DevelopersGroup Particularly helpful Moodlers
Thank you for this very thorough bug report smile 

Your fix is slightly flawed though.  The line that you moved should be before the break, like this:
                    if ($lesson->custom) {
if ($answer->score > 0) {
$correctanswer = true;
} else {
$correctanswer = false;
}
}
$answerid = $answer->id;
break;
}
}
We only want to capture the answer id when the student's answer actually matches one of the teacher defined answers.  If there are no matches, then we don't store the answer id.

If you could confirm that what I did fixes your problem, I'll commit it to CVS.

Cheers,
Mark
 
Average of ratings: -
Picture of Joseph Rézeau
Re: missing student answer in numerical question report
Group DevelopersGroup Particularly helpful MoodlersGroup TestersGroup Translators

Hi Mark!

Thank you for your answer to my bug report. I agree that the $answerid = $answer->id; line should be moved just before the break rather than to where I had suggested to put it.

I also agree with the view that "We only want to capture the answer id when the student's answer actually matches one of the teacher defined answers. If there are no matches, then we don't store the answer id."

However, as a teacher, I am interested in the student's actual answers to my questions, whether they be correct, incorrect (and anticipated as such) or incorrect (and unanticipated). In fact, I am much more interested in the latter category, because unanticipated student's answers are useful if I want to further refine my lesson (or quiz) questions!

Now that the bug in \moodle\mod\lesson\action\continue.php is solved by moving the $answerid = $answer->id; line just before the break, I'd like to report a further bug in the /lesson/report.php

I do want the individual student report (Overview of one attempt by one student) to display the student's actual answers, correct or incorrect, anticipated or not. At the moment, the report only reports anticipated answers (right or wrong). Curiously, there is a condition in report.php which should fill that need but is apparently never met. Around line 615:

} elseif ($answer == end($answers) && empty($answerdata) && $useranswer != NULL) {
// get in here when what the user entered is not one of the answers

As far as I can understand, this condition is too restrictive for unanticipated answers to ever get a chance to be displayed! Actually, from my tests, the program never runs through this condition...

Mark, can you have a look at it and propose a working solution? I'd be grateful.

On the other hand, all of the students' unanticipated answers are correctly displayed in Detailed Statistics.

TIA

Joseph

 
Average of ratings: -
Mark Nielsen in Prague, Czech Republic - 2006
Re: missing student answer in numerical question report
Group DevelopersGroup Particularly helpful Moodlers
Hey Joseph,

The moved $answerid = $answer->id; line has been committed to cvs 1.5 stable and 1.6 dev.

As for your new bug, my tests show this already working correctly. Regardless of matching answer ids, Lesson always stores the student's answer in the database. Could you backup your test case and let me have a look at it? (If it is still not working for you)

Cheers,
Mark
 
Average of ratings: -
Picture of Joseph Rézeau
Re: missing student answer in numerical question report
Group DevelopersGroup Particularly helpful MoodlersGroup TestersGroup Translators

Hello Mark,

>The moved $answerid = $answer->id; line has been committed to cvs 1.5 stable and 1.6 dev.

Thanks!

>As for your new bug, my tests show this already working correctly. Regardless of matching answer ids, Lesson always stores the student's answer in the database.

Oh yes, the student's answer is saved to the database regardless of matching. But the problem lies with the report, as mentioned in my message. Have you checked that the program does go through that loop?

} elseif ($answer == end($answers) && empty($answerdata) && $useranswer != NULL) {
// get in here when what the user entered is not one of the answers

Could you check this ASAP, please, I do need it for a development I am doing at the moment.

Many thanks in advance,

Joseph

 
Average of ratings: -
Mark Nielsen in Prague, Czech Republic - 2006
Re: missing student answer in numerical question report
Group DevelopersGroup Particularly helpful Moodlers
In my test of 1.5 Stable, the elseif in your post evaluates to true and executes the code inside of it.  If yours is not doing this, I would guess that the problem lies in this part of the if condition:

empty($answerdata)

Check to see if that is not empty and if it is not empty, what the heck is in it?

Cheers,
Mark
 
Average of ratings: -