### Recalculating grades - FATAL ERROR

Hello!

Moodle 3.1

Thanks

Re: Recalculating grades - FATAL ERROR

So when you actually go to the gradebook, do you see the new grades?

Re: Recalculating grades - FATAL ERROR

No Emma! I can't go back from that error.

I don't have acecss to any grades in the gardebook

Re: Recalculating grades - FATAL ERROR

Open up another browser and see if you can get to the front page.  You should be able to manually put the url in the browser and navigate somewhere else.

Re: Recalculating grades - FATAL ERROR

I'm having the same problem . I can not access the gradebook or edit it. Any solution?
Re: Recalculating grades - FATAL ERROR

More information please?  What version of Moodle?  What exactly were you trying to do?  Which part of the gradebook can you not access?

Re: Recalculating grades - FATAL ERROR

Hello!

This week we upgradet from Moodle 2.7 to 3.1.

Now in some of our courses we face exactly the same problem. This is intependet from browser or any other client settings. Unfortunately even in debug mode there is no error message which can help to identify the problem.

In detail: Most courses work as normal.
But in some courses if I want to access the gradebook or any gradebook setting in this course the recalculation starts and then it stops. There is no way out and no way to access the grades of this one course.

I suppose that this problem is related to some very special settings for categories or items which are very seldom but I have no idea which one.

Any help or idea?

Re: Recalculating grades - FATAL ERROR

Sounds like the same issue we are having.

At this point, only one course is showing that behavior. (That is, when I click on "Grades" or "Gradebook setup" inside a course, it displays the progress bar for "Recalculating Grades," goes up to 100% then displays a "Continue" button.  Clicking the "Continue" button results in the same "Recalculating Grades display.)

If I go to an individual assignment I can see the student attempts and the assigned grades -- just not through the gradebook.

I have a couple other courses showing the error:

"Note: Some errors have been detected in calculating the grades displayed in the gradebook. If your course has not started or is in progress, it is recommended that the errors are fixed by clicking the button below, though this will result in some grades being changed. If your course has already ended and grades have been submitted, you probably do not want to fix this issue. The newer version is 20160711; you are using gradebook version 20150627. You can see a list of changes in Gradebook calculation changes."

We are using Moodle 3.1.1 (Build: 20160711)

--------------

defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016052300; // The current plugin version (Date: YYYYMMDDXX)$plugin->requires  = 2016051900;        // Requires this Moodle version
\$plugin->component = 'gradereport_grader'; // Full name of the plugin (used for diagnostics)

--------------

diff'd the grader directory with the latest build of 3.1.1 -- no differences found. Odd -- checking all version files under /grade/ in the latest build -- and they all show the same 2016052300 so I wonder where the error message is getting a gradebook version 20160711.

- Arlen

Re: Recalculating grades - FATAL ERROR

Anyone figure out the answer for this?

- Arlen

Re: Recalculating grades - FATAL ERROR

We discovered what was causing this problem for us.

The course getting the repeated recalculating message had an assignment in the gradebook formula that no longer existed.  That is, the final grade formula included an assignment that had been deleted.

We were able to backup/restore the course to a 2.9 moodle instance, adjust the formula, re-backup/restore back to 3.1 and then the gradebook worked.

So, I suspect the code being used to update grades when transition to Moodle 3/3.1 is not cleanly handling this case.

Re: Recalculating grades - FATAL ERROR

Hello!

We are also experiencing the same symptoms and so far with only on one course I know of. We upgraded over the summer from 2.6.4 -> 2.9.6 -> 3.1.1 where the 2.9.6 and the 3.1.1 were a new instance of Moodle [all new code] with the existing database and data directory.

I was able to find a way the professor could view the submitted grades by going to:

where yourMoodleURLhere is your Moodle instance URL

and

where the last numbers after the id= on the end is the course number.

Going to try doing a backup of the course with the problem, restore to a test instance of our production Moodle and see what happens.

Cheers!

Re: Recalculating grades - FATAL ERROR

As was pointed out above, the problem is that custom calculations that are invalid now cause an infinite loop of 'recalculating'.

This can happen if you have a custom calculation, and then you delete an activity that is used in that custom calculation.

We currently get around it by finding the course grade item in grade_items, and settings needsupdate to 0. Then you can access the gradebook editor edit the bad calculation.

I'm opening a MDL ticket for it.

Re: Recalculating grades - FATAL ERROR

Hello!

Thank you for the info and as an FYI the course site we are having issues with does not have any custom grade calculations. All are either Simple weighted mean of grades or Weighted mean of grades.

Cheers!

Re: Recalculating grades - FATAL ERROR

Interesting. Recalculation must be failing for some reason, which causes the needsupdate flag to not clear (which then gets you into this loop).

The best starting place is to try and clear the needsupdate flag in the DB if you have access to it.

Re: Recalculating grades - FATAL ERROR

Hello!

Let me retract my previous comment that there were no custom calculation because I just found out from the professor that he did customize the final grade calculation. This is what he said:

There is a custom grade calculation for the final course grade. In fact, I believe that course grade calculation incorporated data fields that were deleted after I imported the course ...

Sorry for the confusion and now sees to fit in the same scenarios as mentioned previously.

Best!

Re: Recalculating grades - FATAL ERROR

Thanks so much for the information. I was able to get our grade book back up last night.  While I was in the database, I noticed several other records under the needsupdate, also had a 1 as the value. Should I be worried about those as well, or is that normal?

Thanks again

Re: Recalculating grades - FATAL ERROR

Hello!

We were able to fix the problem without directly editing the database - that makes me nervous doing that on our now very active Moodle since classes have started.

You will need the courseid number - which is the end number when viewing the main page of a class site page - for example:

https://yourMoodleURL/course/view.php?id=2818

For the example here, the courseid number is 2818

The you will need to find the id value of the item for the custom grade calculation. For this, I used a mysql command to get the information I needed:

SELECT * FROM mdl_grade_items WHERE courseid = 2818 AND needsupdate = 1;

After all the field names listed and a bunch of lines you should see two numbers - something like this:

| 4789 |     2818 |

where the first number is the id and the second is the courseid number - in this example the id is 4789

With this information use the folowing URL to go directly to the custom grade item:

where you would place in your corresponding numbers for the courseid and id

Hope this makes sense and is useful.

Cheers!

Re: Recalculating grades - FATAL ERROR

Thank you for all of this information.

It did make me very nervous. I will try this tonight because it seems we have another teacher doing the same thing. We have about 15,000 students and many new teachers this year. I am trying to keep things up and running and get our new teachers more training and experience at the same time. This forum has been a life saver.

Thanks again for taking the time to help.

Re: Recalculating grades - FATAL ERROR

Thank you Melanie Hoag. Your solution helped me fix a recalculation problem, which caused the same 'error' that Artur Santos reported, i.e. the recalculation of grades being stuck in a non-stop loop.

Re: Recalculating grades - FATAL ERROR

Hello,

Where do I write the SQL code to find the required item and fix it? Thanks for your help.

Re: Recalculating grades - FATAL ERROR

Thank you so much.

This is the best solution EVER...

You saved my life. Thanks

Re: Recalculating grades - FATAL ERROR

needsupdate being 1 is a normal thing - no need to worry unless you are having this specific problem

Re: Recalculating grades - FATAL ERROR