Recalculating grades after upgrading Moodle

Recalculating grades after upgrading Moodle

by Richard Heath -
Number of replies: 8
Hi all,

I was torn between here and the upgrading forum, but chose here as it's quite grade specific.

We've very recently completed our upgrade of Moodle 4.0 -> 4.2.2 and generally all has gone well. 

One thing we've noticed is that on a large number of our courses, when adding a graded course module (e.g. Assignment, Turnitintooltwo etc.), upon clicking "Save and return to course", we are immediately sent to the regrading page for the module (mod/xxx/modregrade.php), where the progress bar quickly completes and you can click 'continue' to head back to the course. This does not happen with every course (newly set up ones do not get this, for example). I was wondering why it's doing this and what we can do about it (if anything).

I've traced back through the code and DB tables myself but can't get to the root cause of it deciding that everything on a course needs regrading. It seems to receive "needsfrontendregrade" from the processed form which marks the grade_item as "needsupdate=true", but I can't work out what is telling it that it needsfrontendregrade.

Any help very much appreciated!

Richard
In reply to Richard Heath

Re: Recalculating grades after upgrading Moodle

by Sarah Elizabeth Money -

Did you ever get to the bottom of this as it is doing the same to me.  Users are getting emails when recalculated and its causing much confusion.

In reply to Sarah Elizabeth Money

Re: Recalculating grades after upgrading Moodle

by Lisa McIver -
I'd also be interested to know more about this - after upgrading to 4.3 we're seeing similar behavour. It doesn't happen in every course and I've also spotted similar behaviour on Moodle Mount Orange (which I suspect is running 4.5 at the moment). Can anyone explain what is going on?
In reply to Richard Heath

Re: Recalculating grades after upgrading Moodle

by Brett Dalton -
Picture of Moodle HQ Picture of Particularly helpful Moodlers
there has some work been done on Moodle gradebook over 4.1 and 4.2 and I remember there are a number of things that can trigger regrading. Do the courses have weighted groups in the gradebook setup?
In reply to Brett Dalton

Re: Recalculating grades after upgrading Moodle

by Lisa McIver -
There aren't any gradebook weightings in the cases I'm seeing. I've taken a course that is seeing the 'recalculating grade' message and compared it to one that isn't - specifically looking at the Gradebook setup and Course grade settings. In both cases, the settings appear to be identical - even if the behaviour isn't.   It seems that I must be missing something!

In all honesty, our staff tend to steer clear of the gradebook due to it's complexities (but also because we push raw unweighted grades into our student records system - where weightings then take place), so I'd be surprised if the number of issues being reported are related to people having changed things in their gradebooks.
In reply to Lisa McIver

Re: Recalculating grades after upgrading Moodle

by Brett Dalton -
Picture of Moodle HQ Picture of Particularly helpful Moodlers

Good to know.  I'm traveling at the moment but will see if I can check with my team post the Global Moot to see if they have any ideas.  The gradebook setup has been improved in recent versions but the feedback on setup being complex is good feedback.  I'm hoping longer term we can make that whole experience a lot more straightforward 

In reply to Richard Heath

Re: Recalculating grades after upgrading Moodle

by Mihail Geshoski -
Picture of Core developers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi all,

The behaviour described was introduced in https://tracker.moodle.org/browse/MDL-75878 to improve the grade recalculation process triggered when a new gradable activity is created. This update specifically targets large courses, which were most affected by the previous method.

Previously, the activity creation and grade recalculation occurred in the same request. In large courses, this recalculation could take a significant amount of time and sometimes result in a time-out, causing the activity creation to fail as well.

Now, when a new gradable activity is created, a check is performed to determine if the recalculation process will be time-consuming - currently defined as courses with more than 100 grades. In such cases, the recalculation is handled in a separate request with a progress bar displayed. While the overall waiting time remains the same, this approach prevents users from being blocked from creating activities if the recalculation times out. For courses with fewer than 100 grades, the original approach - processing everything within a single request is still used. This explains the discrepancy in behaviour between different courses.

I hope this helps.
In reply to Mihail Geshoski

Re: Recalculating grades after upgrading Moodle

by Lisa McIver -
It's great to have a logical explanation for something that otherwise felt like inconsistent behaviour.

Thanks for taking the time to respond Mihail.
In reply to Mihail Geshoski

Re: Recalculating grades after upgrading Moodle

by Marybeth Koon -

This is helpful to know! Thank you! 

 For clarification, is it determining the "more than 100 grades" criteria by number of students x grade items? For example, for one of our classes, they have a classlist of 26 students and, coincidentally, 26 grade items (600 + grade items). However, in this particular the course right now, the instructor has only issued 2 grades (26 x 2), so despite whether or not a grade has been issued, would it count all the grades and all the students in the recalculating? 

Thanks again,

Marybeth