Each question has an individual maximum mark/grade that you can set. Total of Grades should be the sum of those.
If not, please can you attach a screen-grab of the quiz editing page. Thanks.
Thanks for the screen-grab.
Can you confirm whether you are on Moodle 2.0.x or 2.1.x?
The total is definitely wrong. It would be interesting to do
SELECT * FROM mdl_quiz_question_instances WHERE quiz = ...
... needs to be the quiz id for this quiz, which you can get from the mdl_quiz table. That should contain 51 rows, with the score as you say.
Randomisation normally works. One thing that can go wrong: suppose you have a category with two questions, A and B. Then suppose you make a quiz with question A, and a random question chosen from the category. Then the random question will always be B. However, you don't seem to have made that mistake here.
That is odd. That must have been caused by a bug, but of course the bug happened in the past, and we are only seeing the problem now, so that makes it very hard to know what the bug is.
To fix your problem for now, delete the extra rows.
The safe way to do that is by hand. In your case it is easy, because presumably you just delete all the ones with maxmark = 1.
Another way to do it is to rely on the fact that the quiz.questios column contains a comma-separated list of quetsionids that should be in the quiz, so you can do
DELETE FROM mdl_quiz_question_instances WHERE quiz = 2 AND question NOT IN (... list of question ids ...)
but that has the potential to go horribly wrong.
If you managed to catch what it is you need to do to get bogus quiz_question_instances rows, then please let me know. Thanks.
We got the same problem for one quiz on our Production also. It is so wrong, the teacher then manually changed the grades in the gradebook for 113 students.
Please see the attachment, there are 6 questions, and the maxium grade is 6, but the total of grade is 2. That's why in the statistics view, all of the students' grades are 0, 3, 6, 9, 12, 15, or 18. The teacher manually changed all of them in gradebook.
Since the total grade is really dynamic, it can be calculated eazily, so, why the the "SUMGRADES" column in the QUIZ table is needed. I searched the source code, there are tons of update for this culumn. I am thinking maybe somewhere it is forgot to update?
Here is the data from the QUIZ_QUESTION_INSTANCES table:
"ID" "QUIZ" "QUESTION" "GRADE"
1595 430 16420 1
1596 430 16421 1
1597 430 16422 1
1594 430 16419 1
1598 430 16423 1
1593 430 16418 1
How was this quiz created?
Ok, the quiz is created by randomly selecting from the question bank.
Please another attachment.
I have found an interesting thing: right after I add a random question, the "Total of grades" never changes, it only changes after I click the any "Save" button (besides the grade input field), or I just need to click the "Add page here".
I think the default grade value for each random question is 1. So, right after adding one more random question, the "Total of grades" should update by adding 1, no matter if I click the "Save" or "Add page here" button.
We have not established if you are using 2.1 or 2.0.
I cannot reproduce this. In my Moodle 2.1.1+ install:
- Go to a course and turn editing on.
- Add a new quiz. Give it a name, and save.
- Go to the Edit quiz page.
- Click 'Add to quiz' next to the 'Add  random question' text.
- Verify that Total of grades: changes to 1.00.
Hmm.... Where is your "4. Click 'Add to quiz' next to the 'Add  random question' text."?
I am running 2.0.3. See the attachment 1: when I click the "Add a random question", attachment 2: after I added a random question. From attachment 2, you can see the "Total of grades" is still 0, but suppose to be 1 automatically.
OK, the "Total of grades" will update either I click the "Save" (next to the "Grade") or click the "Add page here".
The button I was using was the one you can see if you [show] the question bank contents.
I can now reproduce the problem you are seeing. Please can you report it as a bug in the Tracker. Thanks.
All right, will do shortly. Just wondering, this is only happening to 2.*, can u see it from 1.* version? Since the random quiz is so important, I mean no one else complained about this before? The first post in this thread was Aug 2011.
The UI for adding random questions to the quiz changed in 2.0 and that is when the bug was introduced.
I am having this issue in Moodle 2.6. Teacher imported a quiz (probably from 2.4), deleted a couple questions, and now has Total of marks: 64.00 | Questions: 57 | See pdf below. Any suggestions?
This is a bug, often caused by a backup and restore problem in the past leaving junk in the database. Specifically there will be junk rows in the quiz_question_instances table, which refer to a questionid that does not exist.
If you delete those rows from the database, then the problem should solve itself. Upgradeing to Moodle 2.7 may also fix the problem.
Thank you for the quick reply. I will look into it.