Gradebook Calculations - 'Error' shown in Gradebook

Gradebook Calculations - 'Error' shown in Gradebook

by Cat Scutt -
Number of replies: 1

Hello,

Apologies for my first post being to ask for help! I have a course with 5 quizzes in it.  I am trying to create a custom column in the gradebook which I want to show *how many* of the quizzes the users have attempted, regardless of the score they have achieved in those quizzes, so if they've tried 3 quizzes the colum will show '3'. 

In order to do this, I need any column which has a grade in to be treated as a score of '1', and any grade which doesn't have a score to be treated as '0', and these to be added together for all 10 quizzes. Since a number divided by itself = 1, except for 0 which (hopefully) = 0, I thought I would be able to do this with the formula:

=sum(quiz1/quiz1, quiz2/quiz2, quiz3/quiz3, quiz4/quiz4, quiz5/quiz5)

However, although this formula is accepted, in the gradebook I just see 'error' in that column.  (Using Moodle 2.09).  Some exploration suggests it doesn't like the same grade item being used twice in one formula...

Does anyone have any suggestions for how I might achieve this, either with the gradebook or with another method?  Using a checklist doesn't work because our logs are only stored for 30 days and completion tracking isn't enabled, and I need to aggregate grades from quiz attempts over the pass year.

Any advice most gratefully received!

In reply to Cat Scutt

Re: Gradebook Calculations - 'Error' shown in Gradebook

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

Your formula will cause a "division by zero" error for any quiz with a grade of 0, or which has not been attempted.

sum(min(quiz1, 1), min(quiz2, 1), ...)

would be a better way, but that only works if the smallest mark the student can get on the quiz is 1. If the studnet might possibly get a fractional total score, like 0.02, then you would need to use a forumla like

sum(min(100*quiz1, 1), min(100*quiz2, 1), ...)