From 165cdabacbe5d537f9693537e5d5eff0f70db07a Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 3 Oct 2014 10:35:32 +0800 Subject: [PATCH] MDL-47146 core_grades: fix class names (contd) Part of: MDL-46576 --- grade/report/grader/lib.php | 6 +++--- grade/tests/report_graderlib_test.php | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 94687c66c41..6aabf4c1a71 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -1696,11 +1696,11 @@ class grade_report_grader extends grade_report { public static function do_process_action($target, $action, $courseid = null) { global $DB; // TODO: this code should be in some grade_tree static method - $targettype = substr($target, 0, 1); - $targetid = substr($target, 1); + $targettype = substr($target, 0, 2); + $targetid = substr($target, 2); // TODO: end - if ($targettype !== 'c') { + if ($targettype !== 'cg') { // The following code only works with categories. return true; } diff --git a/grade/tests/report_graderlib_test.php b/grade/tests/report_graderlib_test.php index 9faf37eab03..8c390661cdb 100644 --- a/grade/tests/report_graderlib_test.php +++ b/grade/tests/report_graderlib_test.php @@ -121,17 +121,17 @@ class core_grade_report_graderlib_testcase extends advanced_testcase { $this->assertEquals($emptypreferences, $report->collapsed); // Validating preferences set/get for one course. - $report->process_action('c13', 'switch_minus'); + $report->process_action('cg13', 'switch_minus'); $report = $this->create_report($course1); $this->assertEquals(array(13), $report->collapsed['aggregatesonly']); $this->assertEmpty($report->collapsed['gradesonly']); - $report->process_action('c13', 'switch_plus'); + $report->process_action('cg13', 'switch_plus'); $report = $this->create_report($course1); $this->assertEmpty($report->collapsed['aggregatesonly']); $this->assertEquals(array(13), $report->collapsed['gradesonly']); - $report->process_action('c13', 'switch_whole'); + $report->process_action('cg13', 'switch_whole'); $report = $this->create_report($course1); $this->assertEquals($emptypreferences, $report->collapsed); @@ -146,18 +146,18 @@ class core_grade_report_graderlib_testcase extends advanced_testcase { $report1 = $this->create_report($course1); foreach ($course1cats as $catid) { - $report1->process_action('c'.$catid, 'switch_minus'); + $report1->process_action('cg'.$catid, 'switch_minus'); } $report2 = $this->create_report($course2); foreach ($course2cats as $catid) { - $report2->process_action('c'.$catid, 'switch_minus'); - $report2->process_action('c'.$catid, 'switch_plus'); + $report2->process_action('cg'.$catid, 'switch_minus'); + $report2->process_action('cg'.$catid, 'switch_plus'); } $report3 = $this->create_report($course3); foreach ($course3cats as $catid) { - $report3->process_action('c'.$catid, 'switch_minus'); + $report3->process_action('cg'.$catid, 'switch_minus'); if (($i++)%2) { - $report3->process_action('c'.$catid, 'switch_plus'); + $report3->process_action('cg'.$catid, 'switch_plus'); } } @@ -201,7 +201,7 @@ class core_grade_report_graderlib_testcase extends advanced_testcase { set_user_preference('grade_report_grader_collapsed_categories'.$course1->id, json_encode($toobigvalue)); $report1 = $this->create_report($course1); - $report1->process_action('c'.$lastvalue, 'switch_minus'); + $report1->process_action('cg'.$lastvalue, 'switch_minus'); $report1 = $this->create_report($course1); $this->assertEquals($expectedvalue, $report1->collapsed); @@ -218,7 +218,7 @@ class core_grade_report_graderlib_testcase extends advanced_testcase { $toobigvalue['aggregatesonly'][] = $lastcatid; $report1 = $this->create_report($course1); - $report1->process_action('c'.$lastcatid, 'switch_minus'); + $report1->process_action('cg'.$lastcatid, 'switch_minus'); // One last value should be removed from both arrays. $report1 = $this->create_report($course1);