Item analysis : summary of the known problems

Item analysis : summary of the known problems

napisao/la Jean-Michel Védrine -
Number of replies: 13
Here is a summary of all the known problems in item analysis quiz report and solutions when available.
1)
The "Warning: Cannot use a scalar value as an array" problem
Discussion : several threads in this forum
Bugtracker report : bug 3492
Fix : given in attachment to bug 3492 thanks to James Dugal
2)
The "Warning: Cannot modify header information" and the download as Excel or text or Open office file not working
BugTracker reports : bug 3617 and bug 3618.
Fix : see attachment to my comment on bug 3617
3)
The misplaced group selection dropdownmenu
This problem is also solved with the fix given for the previous bug
4)
The "Analysis Options" help button produce a file not found error
Fix change :
helpbutton("analysisoptions", get_string("analysisoptions",'quiz_analysis'), 'quiz_analysis');
to :
helpbutton("analysisoptions", get_string("analysisoptions",'quiz_analysis'), 'quiz');
5)
The true/false question problem : responses to true/false questions aren't displayed correctly
Bugtrtacker report : bug 3720
Fix : currently none

The "Attempts to analyze per user" options problem. The only working option is "all attempts" all other produce inexpected results.
Discussion : forum thread
Bugtracker report : bug 3769
Fix : currently none

For all those needing to use item analysis without waiting for Enrique to look into these bugs, I am attaching a modified mod/quiz/report/analysis/report.php with all problem except the last 2 ones fixed.
For the remaining bugs, I am working on a solution.
Prosjek ocjena: -
In reply to Jean-Michel Védrine

Re: Item analysis : summary of the known problems

napisao/la Jean-Michel Védrine -
Here is a fix for problem #5 (responses to true/false questions aren't displayed correctly - bug 3720)
in file mod/quiz/questiontypes/truefalse/questiontype.php, add the lines :
    function get_actual_response($question, $state) {
        $answers = $question->options->answers;
        if (!empty($state->responses)) {
            foreach ($state->responses as $aid =>$rid){
                $responses[] = ($answers['true']->id === $rid) ? get_string("true", "quiz") : get_string("false", "quiz");
            }
        } else {
            $responses[] = '';
        }
        return $responses;
    }
just before the lines :
}
//// END OF CLASS ////
near the end of the file.
Et voila true/false questions are now correctly analysed
In reply to Jean-Michel Védrine

Re: Item analysis : summary of the known problems

napisao/la Martin Dougiamas -
Slika Core developers Slika Documentation writers Slika Moodle HQ Slika Particularly helpful Moodlers Slika Plugin developers Slika Testers
Brilliant, thanks Jean-Michel!   Gustav can we get this in CVS?
In reply to Martin Dougiamas

Re: Item analysis : summary of the known problems

napisao/la Jean-Michel Védrine -
Well not that brilliant Martin, my code can be somewhat simplified because truefalse questions can't have several answers (I didn't realised that at first) and also === is not needed == is enought
so I suggest the code :
    function get_actual_response($question, $state) {
        $answers = $question->options->answers;
        if (!empty($state->responses)) {
                $responses[] = ($answers['true']->id == $state->responses['']) ? get_string("true", "quiz") : get_string("false", "quiz");
        } else {
            $responses[] = '';
        }
        return $responses;
    }
Gustav if you get that in CVS, don't forget to also fix mod/quiz/report/analysis/report.php so that no more errors are displayed because it confuse a lot of Moodle users. I think item analysis is a wonderfull addition to the quiz module (and I like the fact that it support random questions contrary to the old detailed statistics Mooldle 1.4x quiz plugin) and I think other will enjoy using it as much as I do. Thanks to Enrique.
In reply to Martin Dougiamas

Re: Item analysis : summary of the known problems

napisao/la Gustav W Delius -
Thank you so much, Jean-Michel. I am glad that you have had a look at it because I was getting a bit worried that, with Enrique having disappeared, noone would ever fix those  bugs. Unfortunately I have been out of touch for a week but this weekend I will get your fixes into CVS.
In reply to Jean-Michel Védrine

Re: Item analysis : summary of the known problems

napisao/la James Dugal -
Salut, Jean-Michel! I was merging your report.php and found a small error in the stats_sumxy routine. Line 688 is: foreach ($data as $value) { but should be: foreach ($data as $v) { Thanks for your efforts...I'm eager to try them this coming week! --James Dugal (en Louisiane)
In reply to James Dugal

Re: Item analysis : summary of the known problems

napisao/la Jean-Michel Védrine -
Hello James,
Yes you are right, I used $value in an old version and missed this one when I merged your fix. Thanks a lot for this correction.
In reply to Jean-Michel Védrine

Re: Item analysis : summary of the known problems

napisao/la Jean-Michel Védrine -
Another small typo in mod/quiz/report/analysis/report.php :
       $scorelimit = $quiz->grade * $lowmarklimit/ 100;
should be :
       $scorelimit = $quiz->sumgrades * $lowmarklimit/ 100;
because later we compare this to attempt.sumgrades
In reply to Jean-Michel Védrine

Re: Item analysis : summary of the known problems

napisao/la Jean-Michel Védrine -
For the Moodle users interested in a rapid fix of their item analysis report plugin and not wanting to wait for CVS update, here is a zip file with my 2 modified files :
- quiz/questiontypes/truefalse/questiontype.php
- quiz/report/analysis/report.php
These files contain all my fixes for the bugs reported in this thread (with the correction reported by james), including an inelegant one for the "Attempts to analyze per user" options problem (rather than fixing the SQL query wich proved very difficult with mysql not supporting subqueries, I choose to fetch all attempts and discard the unwanted ones in the loop). There is certainly a better way !!
I must mention that if you choose "highest grade" and if some of your students made several attempts with exactly the same highest grade ALL these attempts will be analyzed not just one per student. Maybe we can call that a "feature" because I see no real way to choose a particular attempt among all the best graded for these students ?
In reply to Jean-Michel Védrine

Re: Item analysis : summary of the known problems

napisao/la ryan wise -
I'm getting the following error when trying to 'start again' on a quiz that's already been taken.

Fatal error: Call to a member function print_question() on a non-object in C:\Program Files\xamppx\htdocs\moodle\mod\quiz\locallib.php on line 1984
In reply to Jean-Michel Védrine

Re: Item analysis : summary of the known problems

napisao/la Jason Hando -
What a legend - worked like a gem on my 1.5.2+ upgrade.

If you're ever in Sydney let me buy you a beer. approve