Using empty grades in calculation

Using empty grades in calculation

by Ago Luberg -
Number of replies: 3

I thought this topic is covered somewhere, but didn't find any information on it.

I have an activity (a custom one) which the students can be submit to get a better grade. Technically the grade for the activity can be either 1 ("done") or "-" ("not done"). Now I would just like to use the "-" as 0. For example in formula: "=3 + ACTIVITY". It works for those, who have 1 for the activity. Those with empty grade ("-") get empty result ("-").

Is it possible to use empty grades in formulas somehow? How is it done correctly? Moodle version 3.2.


Thanks!

In reply to Ago Luberg

Re: Using empty grades in calculation

by Ago Luberg -

Is it really not possible?

I think I have been using empty grades as 0-s in some previous versions of Moodle (at least few years ago it seemed to work partially).

In reply to Ago Luberg

Re: Using empty grades in calculation

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

There is an admin grade setting to make empty grades count as zero's.  It will affect the whole gradebook.  Look for the Exclude Empty Grades option...

In reply to Emma Richardson

Re: Using empty grades in calculation

by Ago Luberg -

As I understand, "exclude empty grade" only works for aggregation?

Anyway, my situation is as follows:

I have 2 homeworks, which are required to get a better grade. Grades are 0..5. If you do both homeworks, you can get "5" (if you have enough points). If you do only one, you can get maximum of "4". If you don't do any, you can get max "3". I have made a separate category "maximum grade", which should point out the maximum possible grade.

If a student hasn't done a homework, there will be an empty grade ("-"). I have used the formula:

= 3 + HW1 + HW2

where HW1 and HW2 both are grades wither 0 or 1.

This works in case a student has skipped one HW (then I get "4" as the result). But if both are undone, then I get "-" as the result (instead of "3" what I would like).

Is it somehow possible to get 3 there? Or may-be there is some function which I could use, for example ifempty(X, 0)  (in case X is empty, use 0).