stronk7

Untitled

May 26th, 2020
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. diff --git a/grade/edit/letter/index.php b/grade/edit/letter/index.php
  2. index f7aa9429ef4..550337126ae 100644
  3. --- a/grade/edit/letter/index.php
  4. +++ b/grade/edit/letter/index.php
  5. @@ -229,8 +229,10 @@ if (!$edit) {
  6. }
  7. }
  8.  
  9. + // Cache the changed letters.
  10. if (!empty($letters)) {
  11. - // Ensure that the letters are correctly sorted.
  12. + // For some reason, the cache saves it in the order in which they were entered
  13. + // but we really want to order them in descending order so we sort it here.
  14. krsort($letters);
  15. $cache->set($context->id, $letters);
  16. }
  17. diff --git a/lib/tests/gradelib_test.php b/lib/tests/gradelib_test.php
  18. index 1bf6f5ecf8f..1da820dcff8 100644
  19. --- a/lib/tests/gradelib_test.php
  20. +++ b/lib/tests/gradelib_test.php
  21. @@ -87,7 +87,7 @@ class core_gradelib_testcase extends advanced_testcase {
  22.  
  23. $letters = $cache->get($context->id);
  24. $this->assertEquals(1, count($letters));
  25. - $this->assertEquals($letter->letter, $letters['100.00000']);
  26. + $this->assertTrue(in_array($letter->letter, $letters));
  27.  
  28. remove_grade_letters($context, false);
  29.  
  30. @@ -249,7 +249,8 @@ class core_gradelib_testcase extends advanced_testcase {
  31. /**
  32. * Test the caching of grade letters.
  33. */
  34. - public function test_get_grade_letters(): void {
  35. + public function test_get_grade_letters() {
  36. +
  37. $this->resetAfterTest();
  38.  
  39. $course = $this->getDataGenerator()->create_course();
  40. @@ -272,7 +273,7 @@ class core_gradelib_testcase extends advanced_testcase {
  41. /**
  42. * Test custom letters.
  43. */
  44. - public function test_get_grade_letters_custom(): void {
  45. + public function test_get_grade_letters_custom() {
  46. global $DB;
  47.  
  48. $this->resetAfterTest();
Advertisement
Add Comment
Please, Sign In to add comment