Quiz overall average calculation

Quiz overall average calculation

by Ray Lawrence -
Number of replies: 7
At the risk of undermining what mathematical credibility I may have... I'm not getting the overall average figure displayed in the screen shot below. Can someone explain where I'm going wrong?


Attachment maths.png
Average of ratings: -
In reply to Ray Lawrence

Re: Quiz overall average calculation

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 think it is averaging only the best grade for each user, which means it is close to being right, although a rounding error of 0.011 seems a bit high.

Can you please copy and paste the results of the following three SQL queries here:

SELECT userid, grade FROM mdl_quiz_grades WHERE quiz = 123;

SELECT userid, attempt, sumgrades, preview FROM mdl_quiz_attempts WHERE quiz = 123;

SELECT id, sumgrades, grade FROM mdl_quiz WHERE id = 123;

Replace 123 with the id of your quiz, which you can get from any URL including q=123, like /mod/quiz/report.php?q=1

That should give us the data we need to see what is going on.
In reply to Tim Hunt

Re: Quiz overall average calculation

by Ray Lawrence -
INSERT INTO `mdl_quiz_grades` VALUES (24, 14.286);
INSERT INTO `mdl_quiz_grades` VALUES (25, 14.286);


INSERT INTO `mdl_quiz_attempts` VALUES (24, 3, 1, 0);
INSERT INTO `mdl_quiz_attempts` VALUES (24, 2, 0, 0);
INSERT INTO `mdl_quiz_attempts` VALUES (25, 2, 4, 0);
INSERT INTO `mdl_quiz_attempts` VALUES (24, 1, 10, 0);
INSERT INTO `mdl_quiz_attempts` VALUES (25, 1, 10, 0);

INSERT INTO `mdl_quiz` VALUES (12, 12, 30);
Attachment maths2.png
In reply to Ray Lawrence

Re: Quiz overall average calculation

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Very odd. I created MDL-18266 to track this.
In reply to Tim Hunt

Re: Quiz overall average calculation

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Having played around a bit, I cannot reproduce this on my system. (I tried attempting a quiz several times as different students, change question weights, etc. between attempts, and so on.)

Are you able to make this happen again? Can you give me step-by-step instructions, starting from adding a new quiz?

Also, please can you confirm exactly which Moodle version you are using. Thanks.
In reply to Tim Hunt

Re: Quiz overall average calculation

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Ping!

Any further information? Without more information, I will just have to resolve MDL-18266 as Cannot reproduce.
In reply to Tim Hunt

Re: Quiz overall average calculation

by anne daud -

Hi Tim, I also get this error as above, I am using version 2.1. Before this version I never encounter this problem. I am also not sure why this problem occurred, it's happened not in the all quiz,but a few quizzes. Any solution? 

Thanks

In reply to anne daud

Re: Quiz overall average calculation

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

2.1 is very old, and no longer supported. You really need to upgrade to something more recent (e.g. 2.5.x). I don't know if that will fix your specific issue, but it probably will.