stronk7

Untitled

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