diff --git a/grade/edit/letter/index.php b/grade/edit/letter/index.php index 550337126ae..f7aa9429ef4 100644 --- a/grade/edit/letter/index.php +++ b/grade/edit/letter/index.php @@ -229,10 +229,8 @@ if (!$edit) { } } - // Cache the changed letters. if (!empty($letters)) { - // For some reason, the cache saves it in the order in which they were entered - // but we really want to order them in descending order so we sort it here. + // Ensure that the letters are correctly sorted. krsort($letters); $cache->set($context->id, $letters); } diff --git a/lib/tests/gradelib_test.php b/lib/tests/gradelib_test.php index 67321c73600..1bf6f5ecf8f 100644 --- a/lib/tests/gradelib_test.php +++ b/lib/tests/gradelib_test.php @@ -249,8 +249,7 @@ class core_gradelib_testcase extends advanced_testcase { /** * Test the caching of grade letters. */ - public function test_get_grade_letters() { - + public function test_get_grade_letters(): void { $this->resetAfterTest(); $course = $this->getDataGenerator()->create_course(); @@ -273,7 +272,7 @@ class core_gradelib_testcase extends advanced_testcase { /** * Test custom letters. */ - public function test_get_grade_letters_custom() { + public function test_get_grade_letters_custom(): void { global $DB; $this->resetAfterTest();