MDL-47146 core_grades: fix class names (contd)

Part of: MDL-46576
This commit is contained in:
Marina Glancy 2014-10-03 10:35:32 +08:00 committed by Adrian Greeve
parent 3a1a6c6712
commit 165cdabacb
2 changed files with 13 additions and 13 deletions

View File

@ -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;
}

View File

@ -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);