MDL-47274 core_grades: Correct totals when excluding hidden items

Part of: MDL-46576
MDL-47009 Grades: Improve natural weighting algorithm

It's still not perfect, but this is getting closer.

This is based on Johns work on MDL-47009 (just the algorithm). There are some additional
changes to scale the weights if they do not add up to 1.

Part of: MDL-46576
MDL-47078 Grades: Allow users to have different max grades due to exclusions etc.

This is about making this work with natural weightings.

Part of: MDL-46576
MDL-47059 Grades: Make natural weights work with exclude empty grades

Part of: MDL-46576
MDL-47059 Grades: Make natural weights work with extra credit

Part of: MDL-46576
MDL-47059 Grades: Update the grade_grade if the finalgrade/or the grademax has changed.

Part of: MDL-46576
MDL-46576 grades: new behat step for changing grade settings
MDL-46139 grades: adjust behat to check calculated weight

Part of: MDL-46576
MDL-46139 grades: show aggregation details in the user report

Part of: MDL-46576
MDL-47256 gradebook: Fixed up split in new field upgrade script.

Part of: MDL-46576