MDL-32076 core_grade: fixed the ajax handling of unlimited grades