MDL-46576 core_grades: Fix upgrade to natural weight.

When upgrading from 'Sum of grades' to natural aggregation the
weights were no automatically assigned and the grade totals were
wrong. This has now been rectified.