adding fix for saving grade

This resolves the 500 error issue experienced when trying to send grades via the api mod_assign_save_grade

This is in reference to issue [MDL-43960](https://tracker.moodle.org/browse/MDL-43960)