Is it possible to add conditions (IF) to grade calculations in 1.9?

Is it possible to add conditions (IF) to grade calculations in 1.9?

by Peter Ruthven-Stuart -
Number of replies: 3
Picture of Plugin developers
Hello,

I have been experimenting with the new gradebook features in 1.9.

I understand that when calculating the grade for a category or total grade, it is possible to use various formulas:

http://moodle.org/help.php?module=grade&file=calculation.html

However, it does not appear to be possible to use an IF formula (condition) as can be done in Excel - or am I wrong?

I'd like to be able to calculate a total of x number of quizzes, but not include the scores of quizzes that are less than, for example, 50%.

In Excel, the formula would be as follows:

=SUM((IF(A1>=50,A1,0))+IF(B1>=50,B1,0)+IF(C1>=50,C1,0))

so that quizzes A1, A2 & A3 are added together, but if the score of any one quiz falls below 50%, it is treated as 0%.

For example:

quizA1
quizA2
quizA3
Total
student1
30
80
70
150
student2
60
80
70
210

the total for student1 is only 150 (not 180) because his score for quizA1 is less than 50, and so is treated as zero, so 0+80+70=150

I know it's possible to indicate a "Grade to pass" for any item or category, but this seems to only change the background colour of a score: green for pass, red for fail. It does not effect the category score to which that item belongs.

Any suggestions would be most welcome.
In reply to Peter Ruthven-Stuart

Re: Is it possible to add conditions (IF) to grade calculations in 1.9?

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers
Peter - AFAIK, IF is not part of what can be calculated. I would have to look at the code to verify how the formula is parsed but it would make an interesting feature request for the tracker. Peace - Anthony
In reply to Anthony Borrow

Re: Is it possible to add conditions (IF) to grade calculations in 1.9?

by Peter Ruthven-Stuart -
Picture of Plugin developers
Anthony,

Thanks for your reply.

As you suggested, I have made a feature request: MDL-14274.

Please vote for this feature if you think it might be useful.

Thank you.