MDL-42065 core_grade: Refactored some grade_item queries to improve performance
MDL-42065 core_grade: Added unit test for grade_item query changes