Using the percentage total of a "natural" grade category

Using the percentage total of a "natural" grade category

by Robert Pollak -
Number of replies: 11
Picture of Core developers

Hello!

I have defined two grade categories in a course, both set to Aggregation=Natural.

For the course total I want to define a formula that only depends on the grade percentages of the two categories. How does this work? Directly using the IDs of the two category totals of course only yields the grade sums.

I want to reuse the course later, with different number of assignments in those categories, and different point maximum in some assignments. Therefore I want to avoid using a formula with hard-coded numbers (like the number of assignments or the maximal grade sums per category).

Best regards,
Robert

In reply to Robert Pollak

Re: Using the percentage total of a "natural" grade category

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Why don't you just use the category weighting that is built into natural - not sure why you are trying to write a formula?
In reply to Emma Richardson

Re: Using the percentage total of a "natural" grade category

by Robert Pollak -
Picture of Core developers
Thank you for your suggestion, Emma!

The first category covers assignments worth 5 or 6 points each. The number of these assignments is not known in advance. All points have equal value within the category.
The second category has got assignments worth 50 points each.
The course total is the weighted sum (weights 40 and 60) of the two category percentages, with the additional constraint that both categories need to have 50 % at least.

With "natural" I'd have to manually calculate the necessary weights for the categories. I cannot simply use 40 and 60, because the points of the second category should be worth much less than the ones of the first category. Also, "natural" does not allow to express the additional constraint.
In reply to Robert Pollak

Re: Using the percentage total of a "natural" grade category

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Ok, I am not quite understanding your 50% requirement but maybe you can see if there is a way to write something that counts the number of assignments in the category and divides your total points to get your percentage? If that would help...sorry, not a person that uses the calculations...
In reply to Emma Richardson

Re: Using the percentage total of a "natural" grade category

by Robert Pollak -
Picture of Core developers
Still thank you for trying to help.

The 50 % requirement means that in order to pass the course, one does not only need to reach 50 % in
the weighted sum of the categories, but one also needs to reach 50 % of the points in each category.

Unfortunately, counting the number of assignments does not work because the assignments in the first category do not all have the same number of maximal points.
In reply to Robert Pollak

Re: Using the percentage total of a "natural" grade category

by Ryan Hazen -

I made this happen in a test course. Here's how to do it:

Set up gradebook like this, where you have two categories inside a "Non-Adjusted Course Total" category. I have put some grade items in there for testing & demonstration:

Screenshot of gradebook setup screen with three levels of nested categories

Then open grade calculations for the course total at the bottom of the page:

Gradebook with edit course total calculation expanded

Set the ID numbers in the grade calcucations page to "CAT1" for the first Category, "CAT2" for the Second Category, and "NA_COURSETOTAL" for the third category.

grade calculation page for course total with IDs and Calculation put in.

Now input the following formula in the grade calculation:

=if(AND(NA_COURSETOTAL>=300,CAT1>=200,CAT2>=100),NA_COURSETOTAL,min(299,NA_COURSETOTAL))

NOTE - those blue texts above are meant to have double brackets around them - see picture - they are displaying here as hyperlinks I think (thanks markdown).

Replace the "300" with the 50% value of CAT1, Replace "100" with the 50% value of CAT2, and replace "299" with one integer below the 50% value of the whole course. 

This will freeze the student's grade at just under 50% until both categories have reached 50%. Here is how this is calculating in my demo course:

The solution working in gradebook

Hope that helps - Happy Moodling!

In reply to Ryan Hazen

Re: Using the percentage total of a "natural" grade category

by Robert Pollak -
Picture of Core developers
Thank you, Ryan, for you effort to set up your example!

I have now found an even better way to implement my gradebook:

Here I switched to "Simple weighted mean" to get to percentages of the categories, which then are combined into the weighted mean. Additionally, to get the 50% constraint on each category, I introduced the additional grade item "Minimum Of Categories", defined as
=min(C1,C2)
. This is then combined with the weighted mean via "Lowest grade" to get the overall grade. It this way, the use of custom calculation formulas is minimized.

My only concern is: I have found the Moodle issue Enable change of maximum grade for grade aggregation method "Natural", saying that "Simple Weighted Mean" might at some point be replaced by "Natural". Is that true? Then I would need that issue to be fixed, s.t. "Natural" can replace SWM in my course.

In reply to Robert Pollak

Re: Using the percentage total of a "natural" grade category

by Ryan Hazen -

Clever! Any time you can minimize calculations is better, but I wonder if the user will be given the lowest grade of the two categories in every case instead of the average of the two categories once 50% is reached in both. I may have misunderstood the problem or the solution above. Either way if it works do it!

I'm not on the gradebook development team so I am not certain about this, but I think Natural is meant to be the one aggregation that rules them all. In your case (a category where there is a 5 point assignment and a 6 point assignment that add up to 100), the user would have to set the grade point values to a number (say 50) then weight the assignments to match the 5 and 6 point distribution (weights 45 and 55 respectively). You could also make those point values for the assignment 45 and 55 if you wish.

Then, if you wanted to grade out of 5 then you would use a rubric in the assignment with a max 5 grade and it would scale up to whatever number the grade is. So, in that way natural could still achieve the aggregation you mention above.

However, I don't think any of the aggregation methods are going away for some time. There are a lot of users out there that have these as parts of large enrollment online courses where messing with the grades would have a disastrous cascading effect. Again, if it's working I always say use it. If core does away with SWM in some future update, you can cross that bridge when we come to it.


In reply to Ryan Hazen

Re: Using the percentage total of a "natural" grade category

by Robert Pollak -
Picture of Core developers
Hello Ryan,

you wrote

"Clever! Any time you can minimize calculations is better, but I wonder if the user will be given the lowest grade of the two categories in every case instead of the average of the two categories once 50% is reached in both. I may have misunderstood the problem or the solution above. Either way if it works do it!"

You are right, thanks for pointing out my mistake!
I need to introduce a custom formula for my course total:

=IF(CATMIN<50, CATMIN, WEIGHTED)

There, CATMIN is the computed minimum of categories, and WEIGHTED is the weighted mean.

In reply to Ryan Hazen

Re: Using the percentage total of a "natural" grade category

by Saaid Agherdien -

Hi Ryan

I am very new at this. I have tried to follow your example but get an invalid formula. Would you be able to point me in the right direction. (moodle 3.6). If i replace the "AND" with example "max" it accepts the formula.


In reply to Saaid Agherdien

Re: Using the percentage total of a "natural" grade category

by Saaid Agherdien -
Apologies: I am running 3.6.3 and only saw now that "IF calculations" only available from 3.6.4