Re: Gradebook Conditional Calculations

basically you use the MIN and MAX functions to design factors that give back zero once your grade drops below a certain threshold.

for example:

- total grade is 70% test grade and 30% presentation grade
- total grade should be negative if test score or presentation score are below 50

=(test*0.7+presentation*0.3)*max(min(floor(test)-49;1);0)*max(min(floor(presentation)-49;1);0)

so after calculating our grade, we multiply it with our factors:

max(min(floor(test)-49;1);0)

- floor(test) rounds it down to the next integer, so we don't have to deal with fractions
- then we subtract 49 from this number, so if the student had less than 50 points, we end up with zero
- then we take the minimum of what we end up with and 1, so the factor can never be more than 1
- then we take the maximum of what we end up with and 0, so the factor can never be less than 0

thus, we have a factor that is 0 if the score for test was less than 50, and 1 if it was more than 50 - we multiply the whole grade with that factor, so if the student had less than 50 for the test, the whole grade is zero.

this is very awkward and can get very complicated, however, as I just learned from this thread, apparently there are finally IF-statements for grade calculation in moodle in 3.6, which will make this a lot easier.