Gradebook Conditional Calculations

Gradebook Conditional Calculations

by Alex N -
Number of replies: 5
Are there any resources explaining how to do conditional grading in the Moodle Gradebook? 


I've read this post and modified it for my needs and it works. The problem is I am not sure why it works and I would like to understand it more in depth.

https://moodle.org/mod/forum/discuss.php?d=233979


In reply to Alex N

Re: Gradebook Conditional Calculations

by Hartmut Scherer -

Hi Alex,

Moodle docs is explains the grade calculations HERE. Some examples are also included. If you are not using Moodle 3.6, you can switch to your Moodle version at the top of the Moodle documentation.

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Gradebook Conditional Calculations

by Alex N -
I am currently using Moodle 3.5. Is the If() function a feature added to 3.6?
In reply to Alex N

Re: Gradebook Conditional Calculations

by stefan weber -
Picture of Plugin developers

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.

In reply to stefan weber

Re: Gradebook Conditional Calculations

by Alex N -

Thanks for that detailed explanation Stefan.