Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/grade/edit/letter/index.php b/grade/edit/letter/index.php
- index f7aa9429ef4..550337126ae 100644
- --- a/grade/edit/letter/index.php
- +++ b/grade/edit/letter/index.php
- @@ -229,8 +229,10 @@ if (!$edit) {
- }
- }
- + // Cache the changed letters.
- if (!empty($letters)) {
- - // Ensure that the letters are correctly sorted.
- + // 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.
- krsort($letters);
- $cache->set($context->id, $letters);
- }
- diff --git a/lib/tests/gradelib_test.php b/lib/tests/gradelib_test.php
- index 1bf6f5ecf8f..1da820dcff8 100644
- --- a/lib/tests/gradelib_test.php
- +++ b/lib/tests/gradelib_test.php
- @@ -87,7 +87,7 @@ class core_gradelib_testcase extends advanced_testcase {
- $letters = $cache->get($context->id);
- $this->assertEquals(1, count($letters));
- - $this->assertEquals($letter->letter, $letters['100.00000']);
- + $this->assertTrue(in_array($letter->letter, $letters));
- remove_grade_letters($context, false);
- @@ -249,7 +249,8 @@ class core_gradelib_testcase extends advanced_testcase {
- /**
- * Test the caching of grade letters.
- */
- - public function test_get_grade_letters(): void {
- + public function test_get_grade_letters() {
- +
- $this->resetAfterTest();
- $course = $this->getDataGenerator()->create_course();
- @@ -272,7 +273,7 @@ class core_gradelib_testcase extends advanced_testcase {
- /**
- * Test custom letters.
- */
- - public function test_get_grade_letters_custom(): void {
- + public function test_get_grade_letters_custom() {
- global $DB;
- $this->resetAfterTest();
Advertisement
Add Comment
Please, Sign In to add comment