MDL-76147 gradereport_grader: Remove show calculation setting.

This commit is contained in:
Ilya Tregubov
2023-03-24 09:26:45 +08:00
parent de32a9e57d
commit d2fe7362af
11 changed files with 10 additions and 30 deletions
+1 -10
View File
@@ -48,21 +48,12 @@ class grade_edit_tree {
public $categories = array();
/**
* Show calculator icons next to manual grade items
* @var bool $show_calculations
*/
private $show_calculations;
/**
* Constructor
*/
public function __construct($gtree, $moving, $gpr) {
global $USER, $OUTPUT, $COURSE;
$systemdefault = get_config('moodle', 'grade_report_showcalculations');
$this->show_calculations = get_user_preferences('grade_report_showcalculations', $systemdefault);
$this->gtree = $gtree;
$this->moving = $moving;
$this->gpr = $gpr;
@@ -139,7 +130,7 @@ class grade_edit_tree {
$type = $element['type'];
$iscalculated = ($type == 'item' or $type == 'courseitem' or $type == 'categoryitem') && $object->is_calculated();
$icon = $this->gtree->get_calculation_icon($element, $this->gpr, true);
if ($iscalculated || ($this->show_calculations && $icon)) {
if ($iscalculated || $icon) {
$actionsmenu->add($icon);
}
@@ -52,7 +52,6 @@ class provider implements
public static function get_metadata(collection $items) : collection {
// There are several user preferences (shared between different courses).
// Show/hide toggles preferences.
$items->add_user_preference('grade_report_showcalculations', 'privacy:metadata:preference:grade_report_showcalculations');
$items->add_user_preference('grade_report_showaverages', 'privacy:metadata:preference:grade_report_showaverages');
$items->add_user_preference('grade_report_showuserimage', 'privacy:metadata:preference:grade_report_showuserimage');
$items->add_user_preference('grade_report_showranges', 'privacy:metadata:preference:grade_report_showranges');
@@ -87,7 +86,6 @@ class provider implements
$prefdescription = null;
$transformedvalue = null;
switch ($name) {
case 'grade_report_showcalculations':
case 'grade_report_showaverages':
case 'grade_report_showuserimage':
case 'grade_report_showranges':
@@ -10,3 +10,4 @@ privacy:metadata:preference:grade_report_showeyecons,gradereport_grader
privacy:metadata:preference:grade_report_showlocks,gradereport_grader
privacy:metadata:preference:grade_report_showanalysisicon,gradereport_grader
privacy:metadata:preference:grade_report_showactivityicons,gradereport_grader
privacy:metadata:preference:grade_report_showcalculations,gradereport_grader
@@ -37,7 +37,6 @@ $string['privacy:metadata:preference:grade_report_quickgrading'] = 'Whether to d
$string['privacy:metadata:preference:grade_report_rangesdecimalpoints'] = 'The number of decimal places to display for each range or whether the overall decimal places setting for the category or grade item is used (inherit)';
$string['privacy:metadata:preference:grade_report_rangesdisplaytype'] = 'Whether the range is displayed as real grades, percentages or letters, or whether the display type for the category or grade item is used (inherit)';
$string['privacy:metadata:preference:grade_report_showaverages'] = 'Whether to display an additional row with the average (mean) for each category and grade item';
$string['privacy:metadata:preference:grade_report_showcalculations'] = 'Whether a calculator icon for each grade item and category with a visual indicator that a grade item is calculated is displayed or not when editing is turned on';
$string['privacy:metadata:preference:grade_report_shownumberofgrades'] = 'Whether to display in brackets after each average the number of grades used when calculating the average';
$string['privacy:metadata:preference:grade_report_showonlyactiveenrol'] = 'Whether to display only active enrolled users (not suspended) in gradebook report or all the enrolled users';
$string['privacy:metadata:preference:grade_report_showranges'] = 'Whether to display an additional row with the range for each category and grade item';
@@ -63,3 +62,4 @@ $string['ajaxfailedupdate'] = 'Unable to update [1] for [2]';
$string['ajaxfieldchanged'] = 'The field you are currently editing has changed, would you like to use the updated value?';
$string['ajaxchoosescale'] = 'Choose';
$string['privacy:metadata:preference:grade_report_showactivityicons'] = 'Whether to show the activity icons next to activity names';
$string['privacy:metadata:preference:grade_report_showcalculations'] = 'Whether a calculator icon for each grade item and category with a visual indicator that a grade item is calculated is displayed or not when editing is turned on';
+1 -3
View File
@@ -1586,9 +1586,7 @@ class grade_report_grader extends grade_report {
$lockunlockicon = '';
if (has_capability('moodle/grade:manage', $this->context)) {
if ($this->get_pref('showcalculations')) {
$editcalculationicon = $this->gtree->get_calculation_icon($element, $this->gpr);
}
$editcalculationicon = $this->gtree->get_calculation_icon($element, $this->gpr);
$showhideicon = $this->gtree->get_hiding_icon($element, $this->gpr);
-2
View File
@@ -56,8 +56,6 @@ class grader_report_preferences_form extends moodleform {
$preferences['prefshow'] = array();
$preferences['prefshow']['showcalculations'] = $checkbox_default;
if ($canviewhidden) {
$preferences['prefshow']['showaverages'] = $checkbox_default;
}
-4
View File
@@ -46,10 +46,6 @@ if ($ADMIN->fulltree) {
array(GRADE_REPORT_MEAN_ALL => get_string('meanall', 'grades'),
GRADE_REPORT_MEAN_GRADED => get_string('meangraded', 'grades'))));
$settings->add(new admin_setting_configcheckbox('grade_report_showcalculations',
get_string('showcalculations', 'grades'),
get_string('showcalculations_help', 'grades'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_showaverages', get_string('showaverages', 'grades'),
get_string('showaverages_help', 'grades'), 1));
@@ -68,7 +68,6 @@ class provider_test extends \core_privacy\tests\provider_testcase {
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
set_user_preference('grade_report_showcalculations', 1, $user);
set_user_preference('grade_report_meanselection', GRADE_REPORT_MEAN_GRADED, $user);
set_user_preference('grade_report_studentsperpage', 50, $user);
@@ -81,11 +80,7 @@ class provider_test extends \core_privacy\tests\provider_testcase {
$writer = writer::with_context($context);
$this->assertTrue($writer->has_any_data());
$prefs = $writer->get_user_preferences('gradereport_grader');
$this->assertCount(3, (array) $prefs);
$this->assertEquals(
get_string('privacy:metadata:preference:grade_report_showcalculations', 'gradereport_grader'),
$prefs->grade_report_showcalculations->description
);
$this->assertCount(2, (array) $prefs);
$this->assertEquals(get_string('meangraded', 'grades'), $prefs->grade_report_meanselection->value);
$this->assertEquals(50, $prefs->grade_report_studentsperpage->value);
}
+1
View File
@@ -2,6 +2,7 @@ This files describes API changes in /grade/report/*,
information provided here is intended especially for developers.
=== 4.2 ===
* 'Show calculations' setting has been removed from grader report (link is moved to grade action menu)
* 'Show activity icons' setting has been removed from grader report
* The grade_report_grader:get_icons(), grade_report_grader:get_left_icons_row()
and grade_report_grader:get_right_icons_row() functions have been deprecated and are not used anymore.
+2
View File
@@ -84,3 +84,5 @@ showanalysisicon_help,core_grades
blockunprotect,core_admin
showactivityicons,core_grades
showactivityicons_help,core_grades
showcalculations,core_grades
showcalculations_help,core_grades
+2 -2
View File
@@ -775,8 +775,6 @@ $string['showallhidden'] = 'Show hidden';
$string['showallstudents'] = 'Show all Students';
$string['showaverages'] = 'Show column averages';
$string['showaverages_help'] = 'If enabled, the grader report will contain an additional row displaying the average (mean) for each category and grade item.';
$string['showcalculations'] = 'Show calculations';
$string['showcalculations_help'] = 'If enabled, when editing, a calculator icon is shown for each grade item and category with a visual indicator that a grade item is calculated.';
$string['showgroups'] = 'Show groups';
$string['showhiddenitems'] = 'Show hidden items';
$string['showhiddenitems_help'] = 'Whether hidden grade items are hidden entirely or if the names of hidden grade items are visible to students.
@@ -914,3 +912,5 @@ $string['enableajax_help'] = 'Adds a layer of AJAX functionality to the grader r
$string['controls'] = 'Controls';
$string['showactivityicons'] = 'Show activity icons';
$string['showactivityicons_help'] = 'If enabled, activity icons are shown next to activity names.';
$string['showcalculations'] = 'Show calculations';
$string['showcalculations_help'] = 'If enabled, when editing, a calculator icon is shown for each grade item and category with a visual indicator that a grade item is calculated.';