This is a followup of
MDL-64609, where it was detected that is extremely easy to end with a broken gradebook.
1. Go into a course (can be new) with at least one student
2. Create any grade-able activity, give to it the "g1" idnumber (common activity settings).
2. Go to Gradebook setup
3. Add a category
6. Edit the category calculation and set it to =[[g1]]
7. Delete the activity from the course (and run adhoc tasks if needed to complete the deletion)
8. Once deleted completely, try visiting the overview report, the user report... all them end showing an exception about gradesneedregrading. For example:
So, it's extremely easy to break the gradebook with something as simple as removing an activity or grade item that is being used in calculations. And later it's extremely hard to find which formula is the one causing the mess.
This issue is about:
A) If possible, avoid removing activities or grade items that are being used. Consistency.
B) When any grade item needs update (or its formula is wrong), show it visually, so the teacher knows which one is the problematic item. Visibility.
C) If possible, allow all those reports to work ok, no matter there are items needing update. Apply B) to those reports too.
D) Maybe, coming from
MDL-74449, build some consistency checker (and fixer) so we can see which the status of big and old gradebooks is. I think we'll fins a lot of orphaned stuff in many of them.
PS: Only confirmed in 3.7dev, but I can imagine it's the same in stables, so adding them to the affected versions.