Merge branch 'MDL-76147-master-2' of https://github.com/ilyatregubov/moodle

This commit is contained in:
Jun Pataleta 2023-03-24 09:32:40 +08:00
commit 40a59bccff
46 changed files with 1325 additions and 533 deletions

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

View File

@ -1539,11 +1539,13 @@ class grade_structure {
* @param bool $withdescription Show description if defined by this item.
* @param bool $fulltotal If the item is a category total, returns $categoryname."total"
* instead of "Category total" or "Course total"
* @param moodle_url|null $sortlink Link to sort column.
*
* @return string header
*/
public function get_element_header(&$element, $withlink = false, $icon = true, $spacerifnone = false,
$withdescription = false, $fulltotal = false) {
public function get_element_header(array &$element, bool $withlink = false, bool $icon = true,
bool $spacerifnone = false, bool $withdescription = false, bool $fulltotal = false,
?moodle_url $sortlink = null) {
$header = '';
if ($icon) {
@ -1559,15 +1561,22 @@ class grade_structure {
return $header;
}
if ($withlink && $url = $this->get_activity_link($element)) {
$a = new stdClass();
$a->name = get_string('modulename', $element['object']->itemmodule);
$a->title = $titleunescaped;
$title = get_string('linktoactivity', 'grades', $a);
if ($sortlink) {
$url = $sortlink;
$header = html_writer::link($url, $header,
['title' => $titleunescaped, 'class' => 'gradeitemheader']);
}
$header = html_writer::link($url, $header, array('title' => $title, 'class' => 'gradeitemheader'));
} else {
$header = html_writer::span($header, 'gradeitemheader', array('title' => $titleunescaped, 'tabindex' => '0'));
if (!$sortlink) {
if ($withlink && $url = $this->get_activity_link($element)) {
$a = new stdClass();
$a->name = get_string('modulename', $element['object']->itemmodule);
$a->title = $titleunescaped;
$title = get_string('linktoactivity', 'grades', $a);
$header = html_writer::link($url, $header, ['title' => $title, 'class' => 'gradeitemheader']);
} else {
$header = html_writer::span($header, 'gradeitemheader', ['title' => $titleunescaped, 'tabindex' => '0']);
}
}
if ($withdescription) {
@ -1942,10 +1951,9 @@ class grade_structure {
public function get_edit_link(array $element, object $gpr, array $langstrings): ?string {
$url = null;
$title = '';
if (!has_capability('moodle/grade:manage', $this->context)) {
if (!($element['type'] == 'grade') || !has_capability('moodle/grade:edit', $this->context)) {
if ((!has_capability('moodle/grade:manage', $this->context) &&
(!($element['type'] == 'grade') || !has_capability('moodle/grade:edit', $this->context)))) {
return null;
}
}
$object = $element['object'];
@ -1960,11 +1968,84 @@ class grade_structure {
}
$url = $gpr->add_url_params($url);
$title = $langstrings[0];
} else if (($element['type'] == 'item') || ($element['type'] == 'categoryitem') ||
($element['type'] == 'courseitem')) {
if (empty($object->outcomeid) || empty($CFG->enableoutcomes)) {
$url = new moodle_url('/grade/edit/tree/item.php',
['courseid' => $this->courseid, 'id' => $object->id]);
} else {
$url = new moodle_url('/grade/edit/tree/outcomeitem.php',
['courseid' => $this->courseid, 'id' => $object->id]);
}
$url = $gpr->add_url_params($url);
$title = $langstrings[1];
} else if ($element['type'] == 'category') {
$url = new moodle_url('/grade/edit/tree/category.php',
['courseid' => $this->courseid, 'id' => $object->id]);
$url = $gpr->add_url_params($url);
$title = $langstrings[2];
}
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
}
/**
* Returns link to the advanced grading page
*
* @param array $element An array representing an element in the grade_tree
* @param object $gpr A grade_plugin_return object
* @return string|null
*/
public function get_advanced_grading_link(array $element, object $gpr): ?string {
global $CFG;
/** @var array static cache of the grade.php file existence flags */
static $hasgradephp = [];
$itemtype = $element['object']->itemtype;
$itemmodule = $element['object']->itemmodule;
$iteminstance = $element['object']->iteminstance;
$itemnumber = $element['object']->itemnumber;
// Links only for module items that have valid instance, module and are
// called from grade_tree with valid modinfo.
if ($itemtype == 'mod' && $iteminstance && $itemmodule && $this->modinfo) {
// Get $cm efficiently and with visibility information using modinfo.
$instances = $this->modinfo->get_instances();
if (!empty($instances[$itemmodule][$iteminstance])) {
$cm = $instances[$itemmodule][$iteminstance];
// Do not add link if activity is not visible to the current user.
if ($cm->uservisible) {
if (!array_key_exists($itemmodule, $hasgradephp)) {
if (file_exists($CFG->dirroot . '/mod/' . $itemmodule . '/grade.php')) {
$hasgradephp[$itemmodule] = true;
} else {
$hasgradephp[$itemmodule] = false;
}
}
// If module has grade.php, add link to that.
if ($hasgradephp[$itemmodule]) {
$args = array('id' => $cm->id, 'itemnumber' => $itemnumber);
if (isset($element['userid'])) {
$args['userid'] = $element['userid'];
}
$url = new moodle_url('/mod/' . $itemmodule . '/grade.php', $args);
$title = get_string('advancedgrading', 'gradereport_grader', $itemmodule);
$gpr->add_url_params($url);
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
}
}
}
}
return null;
}
/**
* Return hiding icon for give element
*
@ -2032,9 +2113,8 @@ class grade_structure {
* @return string|null
*/
public function get_hiding_link(array $element, object $gpr, array $langstrings): ?string {
if (!$element['object']->can_control_visibility() ||
(!has_capability('moodle/grade:manage', $this->context) &&
!has_capability('moodle/grade:hide', $this->context))) {
if (!$element['object']->can_control_visibility() || !has_capability('moodle/grade:manage', $this->context) ||
!has_capability('moodle/grade:hide', $this->context)) {
return null;
}
@ -2135,41 +2215,41 @@ class grade_structure {
*/
public function get_locking_link(array $element, object $gpr, array $langstrings): ?string {
$title = '';
$url = new moodle_url('/grade/edit/tree/action.php',
['id' => $this->courseid, 'sesskey' => sesskey(), 'eid' => $element['eid']]);
$url = $gpr->add_url_params($url);
if (has_capability('moodle/grade:manage', $this->context)) {
$title = '';
$url = new moodle_url('/grade/edit/tree/action.php',
['id' => $this->courseid, 'sesskey' => sesskey(), 'eid' => $element['eid']]);
$url = $gpr->add_url_params($url);
if (($element['type'] == 'grade') && ($element['object']->grade_item->is_locked())) {
// Don't allow an unlocking action for a grade whose grade item is locked: just print a state icon.
$strparamobj = new stdClass();
$strparamobj->itemname = $element['object']->grade_item->get_name(true, true);
$strnonunlockable = get_string('nonunlockableverbose', 'grades', $strparamobj);
$title = $langstrings[0];
return html_writer::span($title, 'text-muted dropdown-item', ['title' => $strnonunlockable,
'aria-label' => $title, 'role' => 'menuitem']);
} else if ($element['object']->is_locked()) {
$title = $langstrings[0];
if (!has_capability('moodle/grade:manage', $this->context) &&
!has_capability('moodle/grade:unlock', $this->context)) {
return html_writer::span($title, 'text-muted dropdown-item',
['aria-label' => $title, 'role' => 'menuitem']);
if (($element['type'] == 'grade') && ($element['object']->grade_item->is_locked())) {
// Don't allow an unlocking action for a grade whose grade item is locked: just print a state icon.
$strparamobj = new stdClass();
$strparamobj->itemname = $element['object']->grade_item->get_name(true, true);
$strnonunlockable = get_string('nonunlockableverbose', 'grades', $strparamobj);
$title = $langstrings[0];
return html_writer::span($title, 'text-muted dropdown-item', ['title' => $strnonunlockable,
'aria-label' => $title, 'role' => 'menuitem']);
} else if ($element['object']->is_locked()) {
if (has_capability('moodle/grade:unlock', $this->context)) {
$title = $langstrings[0];
$url->param('action', 'unlock');
} else {
return null;
}
} else {
$url->param('action', 'unlock');
if (has_capability('moodle/grade:lock', $this->context)) {
$title = $langstrings[1];
$url->param('action', 'lock');
} else {
return null;
}
}
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
} else {
$title = $langstrings[1];
if (!has_capability('moodle/grade:manage', $this->context) &&
!has_capability('moodle/grade:lock', $this->context)) {
return html_writer::span($title, 'text-muted dropdown-item',
['aria-label' => $title, 'role' => 'menuitem']);
} else {
$url->param('action', 'lock');
}
return null;
}
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
}
/**
@ -2218,6 +2298,53 @@ class grade_structure {
return $returnactionmenulink ? null : '';
}
/**
* Returns link to edit calculation for a grade item.
*
* @param array $element An array representing an element in the grade_tree
* @param object $gpr A grade_plugin_return object
* @param string $editcalculationstrings Language string
*
* @return string|null
*/
public function get_edit_calculation_link(array $element, object $gpr,
string $editcalculationstrings): ?string {
if (has_capability('moodle/grade:manage', $this->context)) {
$object = $element['object'];
$isscale = $object->gradetype == GRADE_TYPE_SCALE;
$isvalue = $object->gradetype == GRADE_TYPE_VALUE;
// Show calculation icon only when calculation possible.
if (!$object->is_external_item() && ($isscale || $isvalue)) {
$url = new moodle_url('/grade/edit/tree/calculation.php',
['courseid' => $this->courseid, 'id' => $object->id]);
$url = $gpr->add_url_params($url);
return html_writer::link($url, $editcalculationstrings,
['class' => 'dropdown-item', 'aria-label' => $editcalculationstrings, 'role' => 'menuitem']);
}
}
return null;
}
/**
* Returns link to change category view mode.
*
* @param moodle_url $url Url to grader report page
* @param string $title Menu item title
* @param string $action View mode to change to
* @param bool $active Whether link is active in dropdown
*
* @return string|null
*/
public function get_category_view_mode_link(moodle_url $url, string $title, string $action, bool $active = false): ?string {
$urlnew = $url;
$urlnew->param('action', $action);
$active = $active ? 'true' : 'false';
return html_writer::link($urlnew, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'aria-current' => $active, 'role' => 'menuitem']);
}
}
/**
@ -3051,6 +3178,27 @@ abstract class grade_helper {
*/
protected static $aggregationstrings = null;
/**
* Cached grade tree plugin strings
* @var array
*/
protected static $langstrings = [];
/**
* First checks the cached language strings, then returns match if found, or uses get_string()
* to get it from the DB, caches it then returns it.
*
* @param string $strcode
* @param string|null $section Optional language section
* @return string
*/
public static function get_lang_string(string $strcode, ?string $section = null): string {
if (empty(self::$langstrings[$strcode])) {
self::$langstrings[$strcode] = get_string($strcode, $section);
}
return self::$langstrings[$strcode];
}
/**
* Gets strings commonly used by the describe plugins
*

View File

@ -6,6 +6,6 @@ define("gradereport_grader/stickycolspan",["exports"],(function(_exports){Object
* @copyright 2022 Bas Brands <bas@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
const SELECTORS_GRADEPARENT=".gradeparent",SELECTORS_STUDENTHEADER="#studentheader",SELECTORS_TABLEHEADER="th.header",SELECTORS_BEHAT="body.behat-site";_exports.init=()=>{if(document.querySelector(SELECTORS_BEHAT))return;const grader=document.querySelector(SELECTORS_GRADEPARENT),studentHeader=grader.querySelector(SELECTORS_STUDENTHEADER),leftOffset=getComputedStyle(studentHeader).getPropertyValue("left"),rightOffset=getComputedStyle(studentHeader).getPropertyValue("right");grader.querySelectorAll(SELECTORS_TABLEHEADER).forEach((tableHeader=>{if(tableHeader.colSpan>1){const addOffset=tableHeader.offsetWidth-studentHeader.offsetWidth;window.right_to_left()?tableHeader.style.right="calc("+rightOffset+" - "+addOffset+"px )":tableHeader.style.left="calc("+leftOffset+" - "+addOffset+"px )"}}))}}));
const SELECTORS_GRADEPARENT=".gradeparent",SELECTORS_STUDENTHEADER="#studentheader",SELECTORS_TABLEHEADER="th.header",SELECTORS_BEHAT="body.behat-site";_exports.init=()=>{if(document.querySelector(SELECTORS_BEHAT))return;const grader=document.querySelector(SELECTORS_GRADEPARENT),studentHeader=grader.querySelector(SELECTORS_STUDENTHEADER),leftOffset=getComputedStyle(studentHeader).getPropertyValue("left"),rightOffset=getComputedStyle(studentHeader).getPropertyValue("right"),tableHeaders=grader.querySelectorAll(SELECTORS_TABLEHEADER);for(let i=0;i<tableHeaders.length;i++)if(tableHeaders[i].colSpan>1){const addOffset=tableHeaders[i].offsetWidth-studentHeader.offsetWidth;window.right_to_left()?tableHeaders[i].style.right="calc("+rightOffset+" - "+addOffset+"px )":tableHeaders[i].style.left="calc("+leftOffset+" - "+addOffset+"px )"}else tableHeaders[i].style.zIndex=tableHeaders.length-i}}));
//# sourceMappingURL=stickycolspan.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"stickycolspan.min.js","sources":["../src/stickycolspan.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript module for fixing the position of sticky headers with multiple colspans\n *\n * @module gradereport_grader/stickycolspan\n * @copyright 2022 Bas Brands <bas@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nconst SELECTORS = {\n GRADEPARENT: '.gradeparent',\n STUDENTHEADER: '#studentheader',\n TABLEHEADER: 'th.header',\n BEHAT: 'body.behat-site'\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n if (document.querySelector(SELECTORS.BEHAT)) {\n return;\n }\n const grader = document.querySelector(SELECTORS.GRADEPARENT);\n const studentHeader = grader.querySelector(SELECTORS.STUDENTHEADER);\n const leftOffset = getComputedStyle(studentHeader).getPropertyValue('left');\n const rightOffset = getComputedStyle(studentHeader).getPropertyValue('right');\n\n grader.querySelectorAll(SELECTORS.TABLEHEADER).forEach((tableHeader) => {\n if (tableHeader.colSpan > 1) {\n const addOffset = (tableHeader.offsetWidth - studentHeader.offsetWidth);\n if (window.right_to_left()) {\n tableHeader.style.right = 'calc(' + rightOffset + ' - ' + addOffset + 'px )';\n } else {\n tableHeader.style.left = 'calc(' + leftOffset + ' - ' + addOffset + 'px )';\n }\n }\n });\n};\n"],"names":["SELECTORS","document","querySelector","grader","studentHeader","leftOffset","getComputedStyle","getPropertyValue","rightOffset","querySelectorAll","forEach","tableHeader","colSpan","addOffset","offsetWidth","window","right_to_left","style","right","left"],"mappings":";;;;;;;;MAuBMA,sBACW,eADXA,wBAEa,iBAFbA,sBAGW,YAHXA,gBAIK,gCAMS,QACZC,SAASC,cAAcF,8BAGrBG,OAASF,SAASC,cAAcF,uBAChCI,cAAgBD,OAAOD,cAAcF,yBACrCK,WAAaC,iBAAiBF,eAAeG,iBAAiB,QAC9DC,YAAcF,iBAAiBF,eAAeG,iBAAiB,SAErEJ,OAAOM,iBAAiBT,uBAAuBU,SAASC,iBAChDA,YAAYC,QAAU,EAAG,OACnBC,UAAaF,YAAYG,YAAcV,cAAcU,YACvDC,OAAOC,gBACPL,YAAYM,MAAMC,MAAQ,QAAUV,YAAc,MAAQK,UAAY,OAEtEF,YAAYM,MAAME,KAAO,QAAUd,WAAa,MAAQQ,UAAY"}
{"version":3,"file":"stickycolspan.min.js","sources":["../src/stickycolspan.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript module for fixing the position of sticky headers with multiple colspans\n *\n * @module gradereport_grader/stickycolspan\n * @copyright 2022 Bas Brands <bas@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nconst SELECTORS = {\n GRADEPARENT: '.gradeparent',\n STUDENTHEADER: '#studentheader',\n TABLEHEADER: 'th.header',\n BEHAT: 'body.behat-site',\n AVERAGEROW: 'tr.lastrow',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n if (document.querySelector(SELECTORS.BEHAT)) {\n return;\n }\n const grader = document.querySelector(SELECTORS.GRADEPARENT);\n const studentHeader = grader.querySelector(SELECTORS.STUDENTHEADER);\n const leftOffset = getComputedStyle(studentHeader).getPropertyValue('left');\n const rightOffset = getComputedStyle(studentHeader).getPropertyValue('right');\n\n const tableHeaders = grader.querySelectorAll(SELECTORS.TABLEHEADER);\n\n for (let i = 0; i < tableHeaders.length; i++) {\n if (tableHeaders[i].colSpan > 1) {\n const addOffset = (tableHeaders[i].offsetWidth - studentHeader.offsetWidth);\n if (window.right_to_left()) {\n tableHeaders[i].style.right = 'calc(' + rightOffset + ' - ' + addOffset + 'px )';\n } else {\n tableHeaders[i].style.left = 'calc(' + leftOffset + ' - ' + addOffset + 'px )';\n }\n } else {\n tableHeaders[i].style.zIndex = tableHeaders.length - i;\n }\n }\n\n};\n"],"names":["SELECTORS","document","querySelector","grader","studentHeader","leftOffset","getComputedStyle","getPropertyValue","rightOffset","tableHeaders","querySelectorAll","i","length","colSpan","addOffset","offsetWidth","window","right_to_left","style","right","left","zIndex"],"mappings":";;;;;;;;MAuBMA,sBACW,eADXA,wBAEa,iBAFbA,sBAGW,YAHXA,gBAIK,gCAOS,QACZC,SAASC,cAAcF,8BAGrBG,OAASF,SAASC,cAAcF,uBAChCI,cAAgBD,OAAOD,cAAcF,yBACrCK,WAAaC,iBAAiBF,eAAeG,iBAAiB,QAC9DC,YAAcF,iBAAiBF,eAAeG,iBAAiB,SAE/DE,aAAeN,OAAOO,iBAAiBV,2BAExC,IAAIW,EAAI,EAAGA,EAAIF,aAAaG,OAAQD,OACjCF,aAAaE,GAAGE,QAAU,EAAG,OACvBC,UAAaL,aAAaE,GAAGI,YAAcX,cAAcW,YAC3DC,OAAOC,gBACPR,aAAaE,GAAGO,MAAMC,MAAQ,QAAUX,YAAc,MAAQM,UAAY,OAE1EL,aAAaE,GAAGO,MAAME,KAAO,QAAUf,WAAa,MAAQS,UAAY,YAG5EL,aAAaE,GAAGO,MAAMG,OAASZ,aAAaG,OAASD"}

View File

@ -25,7 +25,8 @@ const SELECTORS = {
GRADEPARENT: '.gradeparent',
STUDENTHEADER: '#studentheader',
TABLEHEADER: 'th.header',
BEHAT: 'body.behat-site'
BEHAT: 'body.behat-site',
AVERAGEROW: 'tr.lastrow',
};
/**
@ -40,14 +41,19 @@ export const init = () => {
const leftOffset = getComputedStyle(studentHeader).getPropertyValue('left');
const rightOffset = getComputedStyle(studentHeader).getPropertyValue('right');
grader.querySelectorAll(SELECTORS.TABLEHEADER).forEach((tableHeader) => {
if (tableHeader.colSpan > 1) {
const addOffset = (tableHeader.offsetWidth - studentHeader.offsetWidth);
const tableHeaders = grader.querySelectorAll(SELECTORS.TABLEHEADER);
for (let i = 0; i < tableHeaders.length; i++) {
if (tableHeaders[i].colSpan > 1) {
const addOffset = (tableHeaders[i].offsetWidth - studentHeader.offsetWidth);
if (window.right_to_left()) {
tableHeader.style.right = 'calc(' + rightOffset + ' - ' + addOffset + 'px )';
tableHeaders[i].style.right = 'calc(' + rightOffset + ' - ' + addOffset + 'px )';
} else {
tableHeader.style.left = 'calc(' + leftOffset + ' - ' + addOffset + 'px )';
tableHeaders[i].style.left = 'calc(' + leftOffset + ' - ' + addOffset + 'px )';
}
} else {
tableHeaders[i].style.zIndex = tableHeaders.length - i;
}
});
}
};

View File

@ -52,10 +52,8 @@ 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_showactivityicons', 'privacy:metadata:preference:grade_report_showactivityicons');
$items->add_user_preference('grade_report_showranges', 'privacy:metadata:preference:grade_report_showranges');
// Special rows preferences.
$items->add_user_preference('grade_report_rangesdisplaytype', 'privacy:metadata:preference:grade_report_rangesdisplaytype');
@ -88,10 +86,8 @@ class provider implements
$prefdescription = null;
$transformedvalue = null;
switch ($name) {
case 'grade_report_showcalculations':
case 'grade_report_showaverages':
case 'grade_report_showuserimage':
case 'grade_report_showactivityicons':
case 'grade_report_showranges':
case 'grade_report_shownumberofgrades':
case 'grade_report_quickgrading':

View File

@ -0,0 +1,66 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Grader report upgrade steps.
*
* @package gradereport_grader
* @copyright 2023 Ilya Tregubov <ilya@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Function to upgrade grader report.
*
* @param int $oldversion the version we are upgrading from
* @return bool result
*/
function xmldb_gradereport_grader_upgrade(int $oldversion): bool {
global $DB;
if ($oldversion < 2023032100) {
// Remove grade_report_showquickfeedback, grade_report_enableajax, grade_report_showeyecons,
// grade_report_showlocks, grade_report_showanalysisicon preferences for every user.
$DB->delete_records('user_preferences', ['name' => 'grade_report_showquickfeedback']);
$DB->delete_records('user_preferences', ['name' => 'grade_report_enableajax']);
$DB->delete_records('user_preferences', ['name' => 'grade_report_showeyecons']);
$DB->delete_records('user_preferences', ['name' => 'grade_report_showlocks']);
$DB->delete_records('user_preferences', ['name' => 'grade_report_showanalysisicon']);
// Remove grade_report_showactivityicons, grade_report_showcalculations preferences for every user.
$DB->delete_records('user_preferences', ['name' => 'grade_report_showactivityicons']);
$DB->delete_records('user_preferences', ['name' => 'grade_report_showcalculations']);
// The grade_report_showquickfeedback, grade_report_enableajax, grade_report_showeyecons,
// grade_report_showlocks, grade_report_showanalysisicon settings have been removed.
unset_config('grade_report_showquickfeedback');
unset_config('grade_report_enableajax');
unset_config('grade_report_showeyecons');
unset_config('grade_report_showlocks');
unset_config('grade_report_showanalysisicon');
// The grade_report_showactivityicons, grade_report_showcalculations settings have been removed.
unset_config('grade_report_showactivityicons');
unset_config('grade_report_showcalculations');
// Main savepoint reached.
upgrade_plugin_savepoint(true, 2023032100, 'grade', 'gradereport_grader');
}
return true;
}

View File

@ -9,3 +9,5 @@ ajaxchoosescale,gradereport_grader
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

View File

@ -36,9 +36,7 @@ $string['privacy:metadata:preference:grade_report_meanselection'] = 'Whether cel
$string['privacy:metadata:preference:grade_report_quickgrading'] = 'Whether to display a text input box for each grade, allowing many grades to be edited at the same time';
$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_showactivityicons'] = 'Whether to show the activity icons next to activity names';
$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';
@ -48,6 +46,7 @@ $string['privacy:request:preference:grade_report_grader_collapsed_categories'] =
$string['summarygrader'] = 'A table with the names of students in the first column, with assessable activities grouped by course and category across the top.';
$string['useractivitygrade'] = '{$a} grade';
$string['overriddengrade'] = 'Overridden grade';
$string['advancedgrading'] = 'View {$a} results';
$string['cellactions'] = 'Cell actions';
// Deprecated since Moodle 4.2.
@ -62,3 +61,5 @@ $string['ajaxerror'] = 'Error';
$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';

View File

@ -591,29 +591,18 @@ class grade_report_grader extends grade_report {
* @return array Array of html_table_row objects
*/
public function get_left_rows($displayaverages) {
global $CFG, $USER, $OUTPUT;
global $CFG, $OUTPUT;
$rows = array();
$rows = [];
$showuserimage = $this->get_pref('showuserimage');
// FIXME: MDL-52678 This get_capability_info is hacky and we should have an API for inserting grade row links instead.
$canseeuserreport = false;
$canseesingleview = false;
if (get_capability_info('gradereport/'.$CFG->grade_profilereport.':view')) {
$canseeuserreport = has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context);
}
if (get_capability_info('gradereport/singleview:view')) {
$canseesingleview = has_all_capabilities(array('gradereport/singleview:view', 'moodle/grade:viewall',
'moodle/grade:edit'), $this->context);
}
$hasuserreportcell = $canseeuserreport || $canseesingleview;
$viewfullnames = has_capability('moodle/site:viewfullnames', $this->context);
$extrafields = \core_user\fields::get_identity_fields($this->context);
$arrows = $this->get_sort_arrows($extrafields);
$colspan = 1 + $hasuserreportcell + count($extrafields);
$colspan = 1 + count($extrafields);
$levels = count($this->gtree->levels) - 1;
@ -646,25 +635,17 @@ class grade_report_grader extends grade_report {
$studentheader->text = $arrows['studentname'];
$headerrow->cells[] = $studentheader;
if ($hasuserreportcell) {
$emptyheader = new html_table_cell();
$headerrow->cells[] = $emptyheader;
}
foreach ($extrafields as $field) {
$fieldheader = new html_table_cell();
$fieldheader->attributes['class'] = 'userfield user' . $field;
$fieldheader->scope = 'col';
$fieldheader->header = true;
$fieldheader->text = $arrows[$field];
$headerrow->cells[] = $fieldheader;
}
$rows[] = $headerrow;
$rows = $this->get_left_icons_row($rows, $colspan);
$suspendedstring = null;
$usercount = 0;
@ -705,35 +686,10 @@ class grade_report_grader extends grade_report {
// when horizontally scrolling through the table contents (most noticeable when in RTL mode).
// Therefore, add slight padding on the left or right when using RTL mode.
$usercell->attributes['class'] .= ' pl-3';
$usercell->text .= $this->get_cell_action_menu(['userid' => $userid], 'user');
$userrow->cells[] = $usercell;
$userreportcell = new html_table_cell();
$userreportcell->attributes['class'] = 'userreport';
$userreportcell->header = false;
if ($canseeuserreport) {
$a = new stdClass();
$a->user = $fullname;
$strgradesforuser = get_string('gradesforuser', 'grades', $a);
$url = new moodle_url('/grade/report/'.$CFG->grade_profilereport.'/index.php',
['userid' => $user->id, 'id' => $this->course->id]);
$userreportcell->text .= $OUTPUT->action_icon($url, new pix_icon('t/grades', ''), null,
['title' => $strgradesforuser, 'aria-label' => $strgradesforuser]);
}
if ($canseesingleview) {
$strsingleview = get_string('singleview', 'grades', $fullname);
$url = new moodle_url('/grade/report/singleview/index.php',
['id' => $this->course->id, 'itemid' => $user->id, 'item' => 'user']);
$singleview = $OUTPUT->action_icon($url, new pix_icon('t/editstring', ''), null,
['title' => $strsingleview, 'aria-label' => $strsingleview]);
$userreportcell->text .= $singleview;
}
if ($userreportcell->text) {
$userrow->cells[] = $userreportcell;
}
foreach ($extrafields as $field) {
$fieldcell = new html_table_cell();
$fieldcell->attributes['class'] = 'userfield user' . $field;
@ -771,7 +727,6 @@ class grade_report_grader extends grade_report {
$this->get_sort_arrows();
// Get preferences once.
$showactivityicons = $this->get_pref('showactivityicons');
$quickgrading = $this->get_pref('quickgrading');
// Get strings which are re-used inside the loop.
@ -827,62 +782,42 @@ class grade_report_grader extends grade_report {
$categorycell->header = true;
$categorycell->scope = 'col';
// Print icons.
if (!empty($USER->editing)) {
$categorycell->text .= $this->get_icons($element);
$statusicons = $this->set_grade_status_icons($element);
if ($statusicons) {
$categorycell->text .= $statusicons;
$categorycell->attributes['class'] .= ' statusicons';
}
$headingrow->cells[] = $categorycell;
}
} else {
// Element is a grade_item.
$arrow = '';
if ($element['object']->id == $this->sortitemid) {
if ($this->sortorder == 'ASC') {
$arrow = $this->get_sort_arrow('up', $sortlink);
} else {
$arrow = $this->get_sort_arrow('down', $sortlink);
}
} else {
$arrow = $this->get_sort_arrow('move', $sortlink);
}
$headerlink = $this->gtree->get_element_header($element, true,
$showactivityicons, false, false, true);
true, false, false, true, $sortlink);
$itemcell = new html_table_cell();
$itemcell->attributes['class'] = $type . ' ' . $catlevel .
' highlightable'. ' i'. $element['object']->id;
$itemcell->attributes['data-itemid'] = $element['object']->id;
if ($element['object']->is_hidden()) {
$itemcell->attributes['class'] .= ' dimmed_text';
}
$singleview = '';
// FIXME: MDL-52678 This is extremely hacky we should have an API for inserting grade column links.
if (get_capability_info('gradereport/singleview:view')) {
if (has_all_capabilities(['gradereport/singleview:view', 'moodle/grade:viewall',
'moodle/grade:edit'], $this->context)) {
$strsingleview = get_string('singleview', 'grades',
$element['object']->get_name());
$url = new moodle_url('/grade/report/singleview/index.php', [
'id' => $this->course->id,
'item' => 'grade',
'itemid' => $element['object']->id
]);
$singleview = $OUTPUT->action_icon(
$url,
new pix_icon('t/editstring', ''),
null,
['title' => $strsingleview, 'aria-label' => $strsingleview]
);
}
$singleview = $this->get_cell_action_menu($element, 'gradeitem');
$statusicons = $this->set_grade_status_icons($element);
if ($statusicons) {
$itemcell->attributes['class'] .= ' statusicons';
}
$itemcell->colspan = $colspan;
$itemcell->text = $headerlink . $arrow . $singleview;
$itemcell->text = $headerlink . $arrow . $singleview . $statusicons;
$itemcell->header = true;
$itemcell->scope = 'col';
@ -892,8 +827,6 @@ class grade_report_grader extends grade_report {
$rows[] = $headingrow;
}
$rows = $this->get_right_icons_row($rows);
// Preload scale objects for items with a scaleid and initialize tab indices.
$scaleslist = [];
$tabindices = [];
@ -1007,7 +940,7 @@ class grade_report_grader extends grade_report {
$gradepass = '';
$context->gradepassicon = '';
}
$context->statusicons = $this->set_grade_status_icons($grade);
$context->statusicons = $this->set_grade_status_icons($element);
// If in editing mode, we need to print either a text box or a drop down (for scales)
// grades in item of type grade category or course are not directly editable.
@ -1132,7 +1065,7 @@ class grade_report_grader extends grade_report {
}
if (!$item->needsupdate) {
$context->actionmenu = $this->get_grade_action_menu($element);
$context->actionmenu = $this->get_cell_action_menu($element, 'gradeitem');
}
$itemcell->text = $OUTPUT->render_from_template('gradereport_grader/cell', $context);
@ -1162,39 +1095,45 @@ class grade_report_grader extends grade_report {
/**
* Sets status icons for the grade.
* @param grade_grade $grade Grade
* @param array $element array with grade item info
*
* @return string status icons container HTML
*/
public function set_grade_status_icons(grade_grade $grade) : string {
public function set_grade_status_icons(array $element) : string {
global $OUTPUT;
$attributes = ['class' => 'text-muted'];
$statusicons = '';
if ($grade->is_hidden()) {
if ($element['object']->is_hidden()) {
$statusicons .= $OUTPUT->pix_icon('i/show', $this->get_lang_string('hidden', 'grades'),
'moodle', $attributes);
}
if ($grade->is_locked()) {
if ($element['object']->is_locked()) {
$statusicons .= $OUTPUT->pix_icon('i/lock', $this->get_lang_string('locked', 'grades'),
'moodle', $attributes);
}
if ($grade->is_overridden()) {
$statusicons .= $OUTPUT->pix_icon('i/overriden_grade',
$this->get_lang_string('overridden', 'grades'), 'moodle', $attributes);
if ($element['object'] instanceof grade_grade) {
$grade = $element['object'];
if ($grade->is_overridden()) {
$statusicons .= $OUTPUT->pix_icon('i/overriden_grade',
$this->get_lang_string('overridden', 'grades'), 'moodle', $attributes);
}
if ($grade->is_excluded()) {
$statusicons .= $OUTPUT->pix_icon('i/excluded', $this->get_lang_string('excluded', 'grades'),
'moodle', $attributes);
}
}
if ($grade->is_excluded()) {
$statusicons .= $OUTPUT->pix_icon('i/excluded', $this->get_lang_string('excluded', 'grades'),
'moodle', $attributes);
$class = 'grade_icons';
if ($element['type'] == 'category') {
$class = 'category_grade_icons';
}
if ($statusicons) {
$statusicons = $OUTPUT->container($statusicons, 'grade_icons');
$statusicons = $OUTPUT->container($statusicons, $class);
}
return $statusicons;
}
@ -1236,10 +1175,15 @@ class grade_report_grader extends grade_report {
* @param array $rows The Array of rows for the left part of the report
* @param int $colspan The number of columns this cell has to span
* @return array Array of rows for the left part of the report
* @deprecated since Moodle 4.2 - The row is not shown anymore - we have actions menu.
* @todo MDL-77307 This will be deleted in Moodle 4.6.
*/
public function get_left_icons_row($rows=array(), $colspan=1) {
global $USER;
debugging('The function get_left_icons_row() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
if (!empty($USER->editing)) {
$controlsrow = new html_table_row();
$controlsrow->attributes['class'] = 'controls';
@ -1335,9 +1279,14 @@ class grade_report_grader extends grade_report {
* Builds and return the row of icons when editing is on, for the right part of the grader report.
* @param array $rows The Array of rows for the right part of the report
* @return array Array of rows for the right part of the report
* @deprecated since Moodle 4.2 - The row is not shown anymore - we have actions menu.
* @todo MDL-77307 This will be deleted in Moodle 4.6.
*/
public function get_right_icons_row($rows=array()) {
global $USER;
debugging('The function get_right_icons_row() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
if (!empty($USER->editing)) {
$iconsrow = new html_table_row();
$iconsrow->attributes['class'] = 'controls';
@ -1571,34 +1520,14 @@ class grade_report_grader extends grade_report {
* @return string HTML
*/
protected function get_course_header($element) {
global $OUTPUT;
$actionmenu = $this->get_cell_action_menu($element, 'gradeitem');
$icon = '';
// If object is a category, display expand/contract icon.
if ($element['type'] == 'category') {
// Load language strings.
$strswitchminus = $this->get_lang_string('aggregatesonly', 'grades');
$strswitchplus = $this->get_lang_string('gradesonly', 'grades');
$strswitchwhole = $this->get_lang_string('fullmode', 'grades');
$url = new moodle_url($this->gpr->get_return_url(null, array('target' => $element['eid'], 'sesskey' => sesskey())));
if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
$url->param('action', 'switch_plus');
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_plus', ''), null,
['title' => $strswitchplus, 'aria-label' => $strswitchplus]);
$showing = get_string('showingaggregatesonly', 'grades');
} else if (in_array($element['object']->id, $this->collapsed['gradesonly'])) {
$url->param('action', 'switch_whole');
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_whole', ''), null,
['title' => $strswitchwhole, 'aria-label' => $strswitchwhole]);
$showing = get_string('showinggradesonly', 'grades');
} else {
$url->param('action', 'switch_minus');
$icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_minus', ''), null,
['title' => $strswitchminus, 'aria-label' => $strswitchminus]);
$showing = get_string('showingfullmode', 'grades');
}
if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
$showing = get_string('showingaggregatesonly', 'grades');
} else if (in_array($element['object']->id, $this->collapsed['gradesonly'])) {
$showing = get_string('showinggradesonly', 'grades');
} else {
$showing = get_string('showingfullmode', 'grades');
}
$name = $element['object']->get_name();
@ -1612,7 +1541,7 @@ class grade_report_grader extends grade_report {
$courseheader .= html_writer::div($showing, 'sr-only', [
'id' => $describedbyid
]);
$courseheader .= $icon;
$courseheader .= $actionmenu;
return $courseheader;
}
@ -1624,9 +1553,13 @@ class grade_report_grader extends grade_report {
*
* @param array $element
* @return string HTML
* @deprecated since Moodle 4.2 - The row is not shown anymore - we have actions menu.
* @todo MDL-77307 This will be deleted in Moodle 4.6.
*/
protected function get_icons($element) {
global $CFG, $USER, $OUTPUT;
debugging('The function get_icons() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
if (empty($USER->editing)) {
return '<div class="grade_icons" />';
@ -1653,16 +1586,14 @@ 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);
$lockunlockicon = $this->gtree->get_locking_icon($element, $this->gpr);
}
$gradeanalysisicon = '';
$gradeanalysisicon = '';
if ($element['type'] == 'grade') {
$gradeanalysisicon .= $this->gtree->get_grade_analysis_icon($element['object']);
}
@ -1674,56 +1605,131 @@ class grade_report_grader extends grade_report {
* Returns an action menu for the grade.
*
* @param array $element Array with cell info.
* @param string $mode Mode - gradeitem or user
* @return string
*/
public function get_grade_action_menu(array $element) : string {
global $OUTPUT, $USER;
$editable = true;
public function get_cell_action_menu(array $element, string $mode): string {
global $OUTPUT, $USER, $CFG;
$context = new stdClass();
$editstrings = [];
$editstrings[] = $this->get_lang_string('editgrade', 'grades');
if ($mode == 'gradeitem') {
$editable = true;
$editstrings = [];
$editstrings[] = $this->get_lang_string('editgrade', 'grades');
$editstrings[] = $this->get_lang_string('itemsedit', 'grades');
$editstrings[] = $this->get_lang_string('categoryedit', 'grades');
$hidestrings = [];
$hidestrings[] = $this->get_lang_string('show');
$hidestrings[] = $this->get_lang_string('hide');
$editcalculationstrings = $this->get_lang_string('editcalculation', 'grades');
$lockstrings = [];
$lockstrings[] = $this->get_lang_string('unlock', 'grades');
$lockstrings[] = $this->get_lang_string('lock', 'grades');
$hidestrings = [];
$hidestrings[] = $this->get_lang_string('show');
$hidestrings[] = $this->get_lang_string('hide');
$gradeanalysisstring = $this->get_lang_string('gradeanalysis', 'grades');
$lockstrings = [];
$lockstrings[] = $this->get_lang_string('unlock', 'grades');
$lockstrings[] = $this->get_lang_string('lock', 'grades');
if ($element['type'] == 'grade') {
$context->isgrade = true;
$item = $element['object']->grade_item;
if ($item->is_course_item() || $item->is_category_item()) {
$editable = $this->overridecat;
}
$gradeanalysisstring = $this->get_lang_string('gradeanalysis', 'grades');
if (!empty($USER->editing)) {
if ($editable) {
$context->editurl = $this->gtree->get_edit_link($element, $this->gpr, $editstrings);
if ($element['type'] == 'grade') {
$item = $element['object']->grade_item;
if ($item->is_course_item() || $item->is_category_item()) {
$editable = $this->overridecat;
}
if (has_capability('moodle/grade:manage', $this->context)) {
if (!empty($USER->editing)) {
if ($editable) {
$context->editurl = $this->gtree->get_edit_link($element, $this->gpr, $editstrings);
}
$context->hideurl = $this->gtree->get_hiding_link($element, $this->gpr, $hidestrings);
$context->lockurl = $this->gtree->get_locking_link($element, $this->gpr, $lockstrings);
}
$context->gradeanalysisurl = $this->gtree->get_grade_analysis_link($element['object'], $gradeanalysisstring);
} else if (($element['type'] == 'item') ||
($element['type'] == 'categoryitem') ||
($element['type'] == 'courseitem')) {
if ($element['type'] == 'item') {
foreach ($this->get_report_links($this->context, $this->courseid, $element, $this->gpr, $mode)
as $count => $reportlink) {
$temp = 'reporturl' . $count;
$context->$temp = $reportlink;
}
$context->advancedgradingurl = $this->gtree->get_advanced_grading_link($element, $this->gpr);
}
if (!empty($USER->editing)) {
$context->divider = true;
if ($element['type'] == 'item') {
$context->editurl = $this->gtree->get_edit_link($element, $this->gpr, $editstrings);
}
$context->editcalculationurl =
$this->gtree->get_edit_calculation_link($element, $this->gpr, $editcalculationstrings);
$object = $element['object'];
if ($object->itemmodule !== 'quiz') {
$context->hideurl = $this->gtree->get_hiding_link($element, $this->gpr, $hidestrings);
}
$context->lockurl = $this->gtree->get_locking_link($element, $this->gpr, $lockstrings);
}
} else if ($element['type'] == 'category') {
$categoryid = $element['object']->id;
// Load language strings.
$strswitchminus = $this->get_lang_string('aggregatesonly', 'grades');
$strswitchplus = $this->get_lang_string('gradesonly', 'grades');
$strswitchwhole = $this->get_lang_string('fullmode', 'grades');
$url = new moodle_url($this->gpr->get_return_url(null,
['target' => $element['eid'], 'sesskey' => sesskey()]));
$gradesonly = false;
$aggregatesonly = false;
$fullmode = false;
if (in_array($categoryid, $this->collapsed['gradesonly'])) {
$gradesonly = true;
} else if (in_array($categoryid, $this->collapsed['aggregatesonly'])) {
$aggregatesonly = true;
} else {
$fullmode = true;
}
$context->gradesonlyurl =
$this->gtree->get_category_view_mode_link($url, $strswitchplus, 'switch_plus', $gradesonly);
$context->aggregatesonlyurl =
$this->gtree->get_category_view_mode_link($url, $strswitchminus, 'switch_minus', $aggregatesonly);
$context->fullmodeurl =
$this->gtree->get_category_view_mode_link($url, $strswitchwhole, 'switch_whole', $fullmode);
if (!empty($USER->editing)) {
$context->divider = true;
$context->editurl = $this->gtree->get_edit_link($element, $this->gpr, $editstrings);
$context->hideurl = $this->gtree->get_hiding_link($element, $this->gpr, $hidestrings);
$context->lockurl = $this->gtree->get_locking_link($element, $this->gpr, $lockstrings);
}
}
$context->gradeanalysisurl = $this->gtree->get_grade_analysis_link($element['object'], $gradeanalysisstring);
$context->dataid = $element['object']->id;
} else if ($mode == 'user') {
foreach ($this->get_report_links($this->context, $this->courseid, $element, $this->gpr, $mode)
as $count => $reportlink) {
$temp = 'reporturl' . $count;
$context->$temp = $reportlink;
}
$context->dataid = $element['userid'];
}
if (!empty($USER->editing) || isset($context->gradeanalysisurl)) {
return $OUTPUT->render_from_template('gradereport_grader/grademenu', $context);
if (!empty($USER->editing) || isset($context->gradeanalysisurl) || isset($context->gradesonlyurl)
|| isset($context->aggregatesonlyurl) || isset($context->fullmodeurl) || isset($context->reporturl0)) {
return $OUTPUT->render_from_template('gradereport_grader/cellmenu', $context);
}
return '';
}
/**
* Given a category element returns collapsing +/- icon if available
*
@ -1887,6 +1893,10 @@ class grade_report_grader extends grade_report {
switch ($action) {
case 'switch_minus': // Add category to array of aggregatesonly
$key = array_search($targetid, $collapsed['gradesonly']);
if ($key !== false) {
unset($collapsed['gradesonly'][$key]);
}
if (!in_array($targetid, $collapsed['aggregatesonly'])) {
$collapsed['aggregatesonly'][] = $targetid;
static::set_collapsed_preferences($courseid, $collapsed);
@ -1910,6 +1920,11 @@ class grade_report_grader extends grade_report {
static::set_collapsed_preferences($courseid, $collapsed);
}
$key = array_search($targetid, $collapsed['aggregatesonly']);
if ($key !== false) {
unset($collapsed['aggregatesonly'][$key]);
static::set_collapsed_preferences($courseid, $collapsed);
}
break;
default:
break;

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;
}
@ -106,7 +104,6 @@ class grader_report_preferences_form extends moodleform {
GRADE_REPORT_AGGREGATION_POSITION_LAST => get_string('positionlast', 'grades'));
$preferences['prefshow']['showuserimage'] = $checkbox_default;
$preferences['prefshow']['showactivityicons'] = $checkbox_default;
$preferences['prefshow']['showranges'] = $checkbox_default;
if ($canviewhidden) {

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));
@ -59,9 +55,6 @@ if ($ADMIN->fulltree) {
$settings->add(new admin_setting_configcheckbox('grade_report_showuserimage', get_string('showuserimage', 'grades'),
get_string('showuserimage_help', 'grades'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_showactivityicons', get_string('showactivityicons', 'grades'),
get_string('showactivityicons_help', 'grades'), 1));
$settings->add(new admin_setting_configcheckbox('grade_report_shownumberofgrades', get_string('shownumberofgrades', 'grades'),
get_string('shownumberofgrades_help', 'grades'), 0));

View File

@ -65,6 +65,10 @@
color: #ca3120;
}
.path-grade-report-grader .grade_icons {
text-align: center;
}
/**
* All the floating divs.
*/
@ -91,13 +95,21 @@
* The user cells.
*/
.path-grade-report-grader .gradeparent .user.cell {
min-width: 200px;
width: 200px;
min-width: 250px;
width: 250px;
white-space: normal;
vertical-align: top;
vertical-align: middle;
height: 100px;
}
.path-grade-report-grader .gradeparent .highlightable.cell {
height: 80px;
text-align: center;
vertical-align: top;
padding-top: 20px;
min-width: 150px;
}
.path-grade-report-grader .gradeparent .gradecell {
vertical-align: top;
padding-top: 20px;
@ -117,7 +129,7 @@
overflow: hidden;
text-overflow: ellipsis;
max-width: 200px;
vertical-align: bottom;
vertical-align: middle;
}
/**

View File

@ -1,29 +1,35 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template block_timeline/nav-day-filter
This template renders the day range selector for the timeline view.
@template gradereport_grader/cellmenu
This template renders action menu for a given cell.
Example context (json):
{
"editurl": "<a class='dropdown-item' aria-label='Edit grade' role='menuitem' href='grade/edit/tree/grade.php?courseid=13&itemid=608&userid=85&gpr_type=report&gpr_plugin=grader&gpr_courseid=13'>Edit grade</a>",
"hideurl": "<a class='dropdown-item' aria-label='Single view for this item' role='menuitem' href='grade/edit/tree/action.php?id=13&sesskey=sMAOMLAAN5&eid=n608u85&gpr_type=report&gpr_plugin=grader&gpr_courseid=13&action=hide'>Hide</a>"
"hideurl": "<a class='dropdown-item' aria-label='Hide' role='menuitem' href='grade/edit/tree/action.php?id=13&sesskey=sMAOMLAAN5&eid=n608u85&gpr_type=report&gpr_plugin=grader&gpr_courseid=13&action=hide'>Hide</a>",
"reporturl0": "<a class='dropdown-item' aria-label='Single view for this user' role='menuitem' href='grade/report/singleview/index.php?id=13&amp;itemid=39&amp;item=user&amp;gpr_type=report&amp;gpr_plugin=grader&amp;gpr_courseid=13'>Single view for this user</a>",
"reporturl1": "<a class='dropdown-item' aria-label='User report' role='menuitem' href='grade/report/user/index.php?userid=39&amp;id=13&amp;gpr_type=report&amp;gpr_plugin=grader&amp;gpr_courseid=13'>User report</a>"
}
}}
<div class="action-menu mb-1 moodle-actionmenu grader">
<div class="dropdown">
<button class="btn btn-link btn-icon icon-size-3 grademenubtn"
type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<button class="btn btn-link btn-icon icon-size-3 cellmenubtn"
type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" data-id={{dataid}}>
<i class="icon fa fa-ellipsis-h fa-fw m-0" title="{{#str}} cellactions, gradereport_grader {{/str}}" aria-hidden="true"></i>
<span class="sr-only">{{#str}} cellactions, gradereport_grader {{/str}}</span>
</button>
@ -31,6 +37,15 @@
<div role="menu" class="dropdown-menu">
{{#editurl}}{{{editurl}}}{{/editurl}}
{{#gradeanalysisurl}}{{{gradeanalysisurl}}}{{/gradeanalysisurl}}
{{#editcalculationurl}}{{{editcalculationurl}}}{{/editcalculationurl}}
{{#reporturl0}}{{{reporturl0}}}{{/reporturl0}}
{{#reporturl1}}{{{reporturl1}}}{{/reporturl1}}
{{#gradesonlyurl}}{{{gradesonlyurl}}}{{/gradesonlyurl}}
{{#aggregatesonlyurl}}{{{aggregatesonlyurl}}}{{/aggregatesonlyurl}}
{{#fullmodeurl}}{{{fullmodeurl}}}{{/fullmodeurl}}
{{#divider}}
<div class="dropdown-divider" role="separator"></div>
{{/divider}}
{{#hideurl}}{{{hideurl}}}{{/hideurl}}
{{#lockurl}}{{{lockurl}}}{{/lockurl}}
</div>

View File

@ -88,4 +88,158 @@ class behat_gradereport_grader extends behat_base {
throw new Exception('The specified grade_item with name "' . $itemname . '" does not exist');
}
/**
* Gets course grade category id from coursename.
*
* @throws Exception
* @param string $coursename
* @return int
*/
protected function get_course_grade_category_id(string $coursename) : int {
global $DB;
$sql = "SELECT gc.id
FROM {grade_categories} gc
LEFT JOIN {course} c
ON c.id = gc.courseid
WHERE c.fullname = ?
AND gc.depth = 1";
if ($id = $DB->get_field_sql($sql, [$coursename])) {
return $id;
}
throw new Exception('The specified course grade category with course name "' . $coursename . '" does not exist');
}
/**
* Gets grade category id from its name.
*
* @throws Exception
* @param string $categoryname
* @return int
*/
protected function get_grade_category_id(string $categoryname) : int {
global $DB;
$sql = "SELECT gc.id
FROM {grade_categories} gc
LEFT JOIN {course} c
ON c.id = gc.courseid
WHERE gc.fullname = ?";
if ($id = $DB->get_field_sql($sql, [$categoryname])) {
return $id;
}
throw new Exception('The specified grade category with name "' . $categoryname . '" does not exist');
}
/**
* Clicks on given grade item menu.
*
* @Given /^I click on grade item menu "([^"]*)"$/
* @param string $itemname
*/
public function i_click_on_grade_item_menu(string $itemname) {
$xpath = $this->get_gradeitem_selector($itemname);
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
/**
* Clicks on course grade category menu.
*
* @Given /^I click on course grade category menu "([^"]*)"$/
* @param string $coursename
*/
public function i_click_on_course_category_menu(string $coursename) {
$xpath = $this->get_course_grade_category_selector($coursename);
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
/**
* Clicks on given grade category menu.
*
* @Given /^I click on grade category menu "([^"]*)"$/
* @param string $categoryname
*/
public function i_click_on_category_menu(string $categoryname) {
$xpath = $this->get_grade_category_selector($categoryname);
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
/**
* Gets unique xpath selector for a grade item.
*
* @throws Exception
* @param string $itemname
* @return string
*/
protected function get_gradeitem_selector(string $itemname) : string {
$itemid = $this->get_grade_item_id($itemname);
return "//table[@id='user-grades']//*[@data-id='" . $itemid . "']";
}
/**
* Gets unique xpath selector for a course category.
*
* @throws Exception
* @param string $coursename
* @return string
*/
protected function get_course_grade_category_selector(string $coursename) {
$itemid = $this->get_course_grade_category_id($coursename);
return "//table[@id='user-grades']//*[@data-id='" . $itemid . "']";
}
/**
* Gets unique xpath selector for a grade category.
*
* @throws Exception
* @param string $categoryname
* @return string
*/
protected function get_grade_category_selector(string $categoryname) : string {
$itemid = $this->get_grade_category_id($categoryname);
return "//table[@id='user-grades']//*[@data-id='" . $itemid . "']";
}
/**
* Clicks on given user menu.
*
* @Given /^I click on user menu "([^"]*)"$/
* @param string $student
*/
public function i_click_on_user_menu(string $student) {
$xpath = $this->get_user_selector($student);
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
/**
* Gets unique xpath selector for a user.
*
* @throws Exception
* @param string $student
* @return string
*/
protected function get_user_selector(string $student) : string {
$userid = $this->get_user_id($student);
return "//table[@id='user-grades']//*[@data-id='" . $userid . "']";
}
}

View File

@ -48,24 +48,26 @@ Feature: We can change what we are viewing on the grader report
And I should see "Manual grade"
And I should see "Course total"
And the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- | -7- |
| Student 1 | 80 | 90 | 30 | 170 |
And I click on "Change to aggregates only" "link"
| -1- | -1- | -3- | -4- | -5- | -6- |
| Student 1 | student1@example.com | 80 | 90 | 30 | 170 |
And I click on course grade category menu "Course 1"
And I choose "Show totals only" in the open action menu
And I should not see "Test assignment name 1"
And I should not see "Test assignment name 2"
And I should not see "Manual grade"
And I should see "Course total"
And the following should exist in the "user-grades" table:
| -1- | -4- |
| Student 1 | 170 |
And I click on "Change to grades only" "link"
| -1- | -1- | -3- |
| Student 1 | student1@example.com | 170 |
And I click on course grade category menu "Course 1"
And I click on "Show grades only" "link"
And I should see "Test assignment name 1"
And I should see "Test assignment name 2"
And I should see "Manual grade"
And I should not see "Course total"
And the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- |
| Student 1 | 80 | 90 | 30 |
| -1- | -1- | -3- | -4- | -5- |
| Student 1 | student1@example.com | 80 | 90 | 30 |
@javascript @skip_chrome_zerosize
Scenario: View and minimise the grader report containing hidden activities without the 'moodle/grade:viewhidden' capability
@ -86,21 +88,23 @@ Feature: We can change what we are viewing on the grader report
And I should see "Manual grade"
And I should see "Course total"
And the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- | -7- |
| Student 1 | 80 | - | 30 | 105.71 |
And I click on "Change to aggregates only" "link"
| -1- | -1- | -3- | -4- | -5- | -6- |
| Student 1 | student1@example.com | 80 | - | 30 | 105.71 |
And I click on course grade category menu "Course 1"
And I choose "Show totals only" in the open action menu
And I should not see "Test assignment name 1"
And I should not see "Test assignment name 2"
And I should not see "Manual grade"
And I should see "Course total"
And the following should exist in the "user-grades" table:
| -1- | -4- |
| Student 1 | 105.71 |
And I click on "Change to grades only" "link"
| -1- | -1- | -3- |
| Student 1 | student1@example.com | 105.71 |
And I click on course grade category menu "Course 1"
And I click on "Show grades only" "link"
And I should see "Test assignment name 1"
And I should see "Test assignment name 2"
And I should see "Manual grade"
And I should not see "Course total"
And the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- |
| Student 1 | 80 | - | 30 |
| -1- | -1- | -3- | -4- | -5- |
| Student 1 | student1@example.com | 80 | - | 30 |

View File

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

View File

@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2022112800; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2023032100; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2022111800; // Requires this Moodle version.
$plugin->component = 'gradereport_grader'; // Full name of the plugin (used for diagnostics)

View File

@ -270,6 +270,30 @@ abstract class grade_report {
*/
abstract public function process_action($target, $action);
/**
* Returns an array of links to appropriate report pages for the current element
* @param context_course $context Course context
* @param int $courseid Course ID
* @param array $element An array representing an element in the grade_tree
* @param grade_plugin_return $gpr A grade_plugin_return object
* @param string $mode Mode - gradeitem or user
* @return array Link to appropriate report
*/
public function get_report_links(context_course $context, int $courseid, array $element,
grade_plugin_return $gpr, string $mode): array {
$reports = [];
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
$params = [$context, $courseid, $element, $gpr, $mode];
$component = 'gradereport_' . $plugin;
if ($reportlink = component_callback($component, 'get_report_link', $params)) {
$reports[] = $reportlink;
}
}
return $reports;
}
/**
* First checks the cached language strings, then returns match if found, or uses get_string()
* to get it from the DB, caches it then returns it.
@ -412,13 +436,13 @@ abstract class grade_report {
/**
* Returns an arrow icon inside an <a> tag, for the purpose of sorting a column.
* @param string $direction
* @param moodle_url $sortlink
* @param moodle_url|null $sortlink
*/
protected function get_sort_arrow($direction='move', $sortlink=null) {
protected function get_sort_arrow(string $direction = 'down', ?moodle_url $sortlink = null) {
global $OUTPUT;
$pix = array('up' => 't/sort_desc', 'down' => 't/sort_asc', 'move' => 't/sort');
$matrix = array('up' => 'desc', 'down' => 'asc', 'move' => 'asc');
$strsort = $this->get_lang_string('sort' . $matrix[$direction]);
$pix = ['up' => 't/sort_desc', 'down' => 't/sort_asc'];
$matrix = ['up' => 'desc', 'down' => 'asc'];
$strsort = $this->get_lang_string($matrix[$direction], 'moodle');
$arrow = $OUTPUT->pix_icon($pix[$direction], '', '', ['class' => 'sorticon']);
return html_writer::link($sortlink, $arrow, ['title' => $strsort, 'aria-label' => $strsort]);

View File

@ -17,7 +17,9 @@
namespace gradereport_singleview\report;
use context_course;
use grade_helper;
use grade_report;
use html_writer;
use moodle_url;
use renderer_base;
use stdClass;
@ -196,5 +198,4 @@ class singleview extends grade_report {
return $output->render($menu);
}
}

View File

@ -67,6 +67,8 @@ $string['savegrades'] = 'Saving grades';
$string['save'] = 'Save';
$string['savegradessuccess'] = 'Grades were set for {$a} items';
$string['singleview:view'] = 'View single view';
$string['singleviewreport_user'] = 'Single view for this user';
$string['singleviewreport_gradeitem'] = 'Single view for this item';
$string['summarygrade'] = 'A table of users, with columns for range, grade, feedback, and whether to override or exclude a particular grade.';
$string['summaryuser'] = 'A table of grade items, with columns for grade category, range, grade, feedback, and whether to override or exclude a particular grade.';
$string['unsavedataalert'] = 'If you have unsaved changes on the page, you will lose them if you proceed with bulk insert grades.';

View File

@ -0,0 +1,74 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Singleview report generic functions
*
* @package gradereport_singleview
* @copyright 2023 Ilya Tregubov
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Returns link to singleview report for the current element
*
* @param context_course $context Course context
* @param int $courseid Course ID
* @param array $element An array representing an element in the grade_tree
* @param grade_plugin_return $gpr A grade_plugin_return object
* @param string $mode Mode - gradeitem or user
* @return string|null
*/
function gradereport_singleview_get_report_link(context_course $context, int $courseid,
array $element, grade_plugin_return $gpr, string $mode): ?string {
$reportstring = grade_helper::get_lang_string('singleviewreport_' . $mode, 'gradereport_singleview');
if ($mode == 'gradeitem') {
// View all grades items.
// FIXME: MDL-52678 This is extremely hacky we should have an API for inserting grade column links.
if (get_capability_info('gradereport/singleview:view')) {
if (has_all_capabilities(['gradereport/singleview:view', 'moodle/grade:viewall',
'moodle/grade:edit'], $context)) {
$url = new moodle_url('/grade/report/singleview/index.php', [
'id' => $courseid,
'item' => 'grade',
'itemid' => $element['object']->id
]);
$gpr->add_url_params($url);
return html_writer::link($url, $reportstring,
['class' => 'dropdown-item', 'aria-label' => $reportstring, 'role' => 'menuitem']);
}
}
} else if ($mode == 'user') {
// FIXME: MDL-52678 This get_capability_info is hacky and we should have an API for inserting grade row links instead.
$canseesingleview = false;
if (get_capability_info('gradereport/singleview:view')) {
$canseesingleview = has_all_capabilities(['gradereport/singleview:view',
'moodle/grade:viewall', 'moodle/grade:edit'], $context);
}
if ($canseesingleview) {
$url = new moodle_url('/grade/report/singleview/index.php',
['id' => $courseid, 'itemid' => $element['userid'], 'item' => 'user']);
$gpr->add_url_params($url);
return html_writer::link($url, $reportstring,
['class' => 'dropdown-item', 'aria-label' => $reportstring, 'role' => 'menuitem']);
}
}
return null;
}

View File

@ -33,7 +33,8 @@ Feature: We can bulk insert grades for students in a course
Scenario: I can not save bulk insert until I fill required form elements
Given I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Test assignment one"
And I click on grade item menu "Test assignment one"
And I choose "Single view for this item" in the open action menu
And I click on "Actions" "link"
When I click on "Bulk insert" "link"
And the "Empty grades" "radio" should be disabled
@ -60,7 +61,8 @@ Feature: We can bulk insert grades for students in a course
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Test assignment one"
And I click on grade item menu "Test assignment one"
And I choose "Single view for this item" in the open action menu
And the field "Grade for Student 1" matches value "50.00"
And the field "Override for Student 1" matches value "0"
And I click on "Actions" "link"
@ -102,7 +104,8 @@ Feature: We can bulk insert grades for students in a course
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode on
And I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Student 1"
And I click on user menu "Student 1"
And I choose "Single view for this user" in the open action menu
And the field "Grade for Test assignment two" matches value "50.00"
And the field "Override for Test assignment two" matches value "0"
And I click on "Actions" "link"
@ -122,7 +125,8 @@ Feature: We can bulk insert grades for students in a course
Scenario: I can not update grades if the value is out of bounds.
Given I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Test assignment one"
And I click on grade item menu "Test assignment one"
And I choose "Single view for this item" in the open action menu
And I click on "Actions" "link"
When I click on "Bulk insert" "link"
And I click on "I understand that my unsaved changes will be lost." "checkbox"

View File

@ -106,14 +106,17 @@ Feature: We can use Single view
And the "Override for Test assignment one" "checkbox" should be enabled
Scenario: Single view links work on grade report.
Given I follow "Single view for Test assignment one"
Then I should see "Test assignment one"
Then I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Ann, Jill, Grainne, Beauchamp"
Given I click on grade item menu "Test assignment one"
And I choose "Single view for this item" in the open action menu
And I should see "Test assignment one"
When I navigate to "View > Grader report" in the course gradebook
And I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
Then I should see "Gronya,Beecham"
Scenario: I can bulk update grades.
Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
Given I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
And I should see "Gronya,Beecham"
When I turn editing mode on
And I click on "Actions" "link"
@ -128,7 +131,8 @@ Feature: We can use Single view
Given the following "language customisations" exist:
| component | stringid | value |
| core_langconfig | decsep | # |
And I follow "Single view for Ann, Jill, Grainne, Beauchamp"
And I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
And I should see "Gronya,Beecham"
When I turn editing mode on
And I click on "Actions" "link"
@ -146,7 +150,8 @@ Feature: We can use Single view
And the field "Grade for Test grade item" matches value "1#00"
Scenario: Navigation works in the Single view.
Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
Given I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
Then I should see "Gronya,Beecham"
And I follow "Nee,Chumlee"
Then I should see "Nee,Chumlee"
@ -161,7 +166,8 @@ Feature: We can use Single view
Then I should see "Test assignment four"
Scenario: Activities are clickable only when it has a valid activity page.
Given I follow "Single view for Ann, Jill, Grainne, Beauchamp"
Given I click on user menu "Grainne Beauchamp"
And I choose "Single view for this user" in the open action menu
And "new grade item 1" "link" should not exist in the "//tbody//tr[position()=1]//td[position()=2]" "xpath_element"
Then "Category total" "link" should not exist in the "//tbody//tr[position()=2]//td[position()=2]" "xpath_element"
And "Course total" "link" should not exist in the "//tbody//tr[position()=last()]//td[position()=2]" "xpath_element"

View File

@ -2,11 +2,18 @@ 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.
* 'Show grade analysis icon' setting has been removed from grader report (link is moved to grade action menu)
* 'Show locks' setting has been removed from grader report (link is moved to grade action menu)
* 'Show show/hide icons' setting has been removed from grader report (link is moved to grade action menu)
* 'Enable AJAX' interface has been deprecated for grader report
* 'Quick feedback' interface has been deprecated for grader report
* A new method grade_report::get_report_links() is created to obtain links to other grade plugins report pages.
It loops through all installed grade report plugins and checks if callback function gradereport_*_get_report_link
is implemented in for given grade report plugin in the corresponding lib.php
=== 3.6 ===
* External function gradereport_user_external::get_grade_items now return the following information (only for course managers).

View File

@ -19,8 +19,11 @@ namespace gradereport_user\report;
use context_course;
use course_modinfo;
use grade_grade;
use grade_helper;
use grade_report;
use grade_tree;
use html_writer;
use moodle_url;
defined('MOODLE_INTERNAL') || die;

View File

@ -34,3 +34,4 @@ $string['userreportdesc'] = 'User reports include a users grades, feedback an
$string['userreports'] = 'Select a user above to view their report';
$string['privacy:metadata:preference:gradereport_user_view_user'] = 'Whether to view report as current user or another user in the gradebook reports';
$string['tablesummary'] = 'The table is arranged as a list of graded items including categories of graded items. When items are in a category they will be indicated as such.';
$string['userreport_user'] = 'User report';

View File

@ -238,3 +238,37 @@ function gradereport_user_myprofile_navigation(tree $tree, stdClass $user, bool
}
}
}
/**
* Returns link to user report for the current element
*
* @param context_course $context Course context
* @param int $courseid Course ID
* @param array $element An array representing an element in the grade_tree
* @param grade_plugin_return $gpr A grade_plugin_return object
* @param string $mode Mode - gradeitem or user
* @return string|null
*/
function gradereport_user_get_report_link(context_course $context, int $courseid, array $element,
grade_plugin_return $gpr, string $mode): ?string {
global $CFG;
if ($mode == 'user') {
$reportstring = grade_helper::get_lang_string('userreport_' . $mode, 'gradereport_user');
// FIXME: MDL-52678 This get_capability_info is hacky and we should have an API for inserting grade row links instead.
$canseeuserreport = false;
if (get_capability_info('gradereport/' . $CFG->grade_profilereport . ':view')) {
$canseeuserreport = has_capability('gradereport/' . $CFG->grade_profilereport . ':view', $context);
}
if ($canseeuserreport) {
$url = new moodle_url('/grade/report/' . $CFG->grade_profilereport . '/index.php',
['userid' => $element['userid'], 'id' => $courseid]);
$gpr->add_url_params($url);
return html_writer::link($url, $reportstring,
['class' => 'dropdown-item', 'aria-label' => $reportstring, 'role' => 'menuitem']);
}
}
return null;
}

View File

@ -24,26 +24,18 @@ Feature: Site settings can be used to hide parts of the gradebook UI
@javascript
Scenario: Hide minimum grade
When I click on "Edit assign Assignment1" "link"
Given I click on grade item menu "Assignment1"
When I choose "Edit grade item" in the open action menu
And I should see "Minimum grade"
Then I navigate to "Grades > General settings" in site administration
And I set the field "Show minimum grade" to "0"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit assign Assignment1" "link"
And I click on grade item menu "Assignment1"
And I choose "Edit grade item" in the open action menu
And I should not see "Minimum grade"
@javascript
Scenario: Hide calculation icons
And "Edit calculation for Course total" "link" should exist
When I navigate to "Grades > Report settings > Grader report" in site administration
And I set the field "Show calculations" to "0"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
Then "Edit calculation for Course total" "link" should not exist
@javascript
Scenario: Disable category overriding
And "tr .course input[type='text']" "css_element" should exist

View File

@ -53,12 +53,12 @@ Feature: We can use calculated grade totals
And I give the grade "5.00" to the user "Student 1" for the grade item "Test assignment nine"
And I press "Save changes"
And I change window size to "large"
And I set the following settings for grade item "Test assignment two":
| Hidden | 1 |
And I set the following settings for grade item "Test assignment five":
| Hidden | 1 |
And I set the following settings for grade item "Test assignment eight":
| Hidden | 1 |
And I click on grade item menu "Test assignment two"
And I choose "Hide" in the open action menu
And I click on grade item menu "Test assignment five"
And I choose "Hide" in the open action menu
And I click on grade item menu "Test assignment eight"
And I choose "Hide" in the open action menu
And I change window size to "medium"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Grade display type" to "Real (percentage)"
@ -66,13 +66,22 @@ Feature: We can use calculated grade totals
Scenario: Mean of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mean of grades |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mean of grades |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mean of grades |
| Exclude empty grades | 0 |
And I press "Save changes"
And I turn editing mode off
Then I should see "30.00 (30.00 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -85,17 +94,29 @@ Feature: We can use calculated grade totals
Scenario: Weighted mean of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Weighted mean of grades |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Weighted mean of grades |
| Item weight | 1 |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Weighted mean of grades |
| Item weight | 1 |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test assignment one &":
And I press "Save changes"
And I click on grade item menu "Test assignment one &"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Item weight | 3 |
And I press "Save changes"
And I turn editing mode off
Then I should see "27.14 (27.14 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -108,15 +129,27 @@ Feature: We can use calculated grade totals
Scenario: Simple weighted mean of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Simple weighted mean of grades |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Simple weighted mean of grades |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Simple weighted mean of grades |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test assignment one &":
And I press "Save changes"
And I click on grade item menu "Test assignment one &"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Extra credit | 1 |
And I press "Save changes"
And I turn editing mode off
Then I should see "45.19 (45.19 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -129,15 +162,27 @@ Feature: We can use calculated grade totals
Scenario: Mean of grades (with extra credits) aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mean of grades (with extra credits) |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mean of grades (with extra credits) |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mean of grades (with extra credits) |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test assignment one &":
And I press "Save changes"
And I click on grade item menu "Test assignment one &"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Extra credit weight | 2 |
And I press "Save changes"
And I turn editing mode off
Then I should see "42.50 (42.50 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -150,13 +195,22 @@ Feature: We can use calculated grade totals
Scenario: Median of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Median of grades |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Median of grades |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Median of grades |
| Exclude empty grades | 0 |
And I press "Save changes"
And I turn editing mode off
Then I should see "26.67 (26.67 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -169,17 +223,32 @@ Feature: We can use calculated grade totals
Scenario: Lowest grade aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Lowest grade |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Lowest grade |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Lowest grade |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test assignment five":
And I press "Save changes"
And I click on grade item menu "Test assignment five"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Hidden | 1 |
And I set the following settings for grade item "Test assignment four":
And I press "Save changes"
And I click on grade item menu "Test assignment four"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Hidden | 1 |
And I press "Save changes"
And I turn editing mode off
Then I should see "0.00 (0.00 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -192,15 +261,27 @@ Feature: We can use calculated grade totals
Scenario: Highest grade aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Highest grade |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Highest grade |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Highest grade |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test assignment one &":
And I press "Save changes"
And I click on grade item menu "Test assignment one &"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Hidden | 1 |
And I press "Save changes"
And I turn editing mode off
Then I should see "50.00 (50.00 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -213,15 +294,27 @@ Feature: We can use calculated grade totals
Scenario: Mode of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mode of grades |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mode of grades |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Mode of grades |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test assignment one &":
And I press "Save changes"
And I click on grade item menu "Test assignment one &"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Hidden | 1 |
And I press "Save changes"
And I turn editing mode off
Then I should see "50.00 (50.00 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -268,7 +361,7 @@ Feature: We can use calculated grade totals
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Test outcome item one":
| Extra credit | 1 |
| Extra credit | 1 |
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
@ -307,8 +400,8 @@ Feature: We can use calculated grade totals
| Include outcomes in aggregation | 1 |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test outcome item one":
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
And I change window size to "large"
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
@ -326,20 +419,35 @@ Feature: We can use calculated grade totals
Scenario: Natural aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Sub category 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 1 |
And I set the following settings for grade item "Course 1":
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test assignment six":
And I press "Save changes"
And I click on grade item menu "Test assignment six"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Weight adjusted | 1 |
| aggregationcoef2 | 50 |
And I set the following settings for grade item "Test assignment three":
And I press "Save changes"
And I click on grade item menu "Test assignment three"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Extra credit | 1 |
And I press "Save changes"
And I turn editing mode off
Then I should see "152.68 (24.43 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
@ -384,15 +492,24 @@ Feature: We can use calculated grade totals
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I set the following settings for grade item "Sub category 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Course 1":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I press "Add category"
And I set the following fields to these values:
@ -423,15 +540,21 @@ Feature: We can use calculated grade totals
And I turn editing mode off
Then I should see "250.00 (25.25 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2":
And I click on grade item menu "Manual item 2"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Extra credit | 1 |
And I press "Save changes"
And I turn editing mode off
And I should see "270.00 (27.27 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2":
And I click on grade item menu "Manual item 2"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Rescale existing grades | No |
| Maximum grade | 200 |
| Extra credit | 0 |
And I press "Save changes"
# Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
And I change window size to "5120x2160"
And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
@ -441,10 +564,13 @@ Feature: We can use calculated grade totals
And I turn editing mode off
And I should see "270.00 (22.69 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2":
And I click on grade item menu "Manual item 2"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Rescale existing grades | No |
| Maximum grade | 100 |
| Extra credit | 0 |
And I press "Save changes"
# Change window size to ultra-wide to avoid 'out-of-bounds' random failures.
And I change window size to "5120x2160"
And I give the grade "21.00" to the user "Student 1" for the grade item "Manual item 2"
@ -516,15 +642,24 @@ Feature: We can use calculated grade totals
Scenario: Natural aggregation with weights of zero
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1":
And I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Sub category 1":
And I press "Save changes"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Sub category 2 &":
And I press "Save changes"
And I click on grade category menu "Sub category 2 &"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I press "Save changes"
And I turn editing mode off
And I navigate to "Setup > Gradebook setup" in the course gradebook
And "//span[@class='grateitemheader'][@title='Sub category 2 &amp;']" "xpath_element" should not exist

View File

@ -37,297 +37,360 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I follow "Edit Cat mean"
And I click on grade category menu "Cat mean"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Weight adjusted | 1 |
| Weight | 20 |
| Extra credit | 0 |
And I press "Save changes"
And I follow "Edit Cat median"
And I click on grade category menu "Cat median"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Weight adjusted | 1 |
| Weight | 5 |
| Extra credit | 0 |
And I press "Save changes"
And I follow "Edit Cat min"
And I click on grade category menu "Cat min"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Weight adjusted | 0 |
| Weight | 0 |
| Extra credit | 1 |
And I press "Save changes"
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I follow "Edit Item b1"
And I click on grade item menu "Item b1"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b2"
And I click on grade item menu "Item b2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b3"
And I click on grade item menu "Item b3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I follow "Edit Item b4"
And I click on grade item menu "Item b4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
Scenario: Switching a category from Natural aggregation to Mean of grades and back
Given I follow "Edit Course 1"
Given I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Mean of grades"
When I press "Save changes"
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
Then I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Cat mean"
And I click on grade category menu "Cat mean"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Weight" in the "#id_headerparent" "css_element"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Cat median"
And I click on grade category menu "Cat median"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Weight" in the "#id_headerparent" "css_element"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Cat min"
And I click on grade category menu "Cat min"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Weight" in the "#id_headerparent" "css_element"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Cat natural &"
And I click on grade category menu "Cat natural &"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Mean of grades"
And I press "Save changes"
And I follow "Edit Item b1"
And I click on grade item menu "Item b1"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Item b2"
And I click on grade item menu "Item b2"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Item b3"
And I click on grade item menu "Item b3"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
And I follow "Edit Item b4"
And I click on grade item menu "Item b4"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Weight"
And I should not see "Extra credit"
And I press "Cancel"
# Switching back.
And I follow "Edit Course 1"
Given I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat mean"
And I click on grade category menu "Cat mean"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat median"
And I click on grade category menu "Cat median"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat min"
And I click on grade category menu "Cat min"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat natural &"
And I click on grade category menu "Cat natural &"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I follow "Edit Item b1"
And I click on grade item menu "Item b1"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b2"
And I click on grade item menu "Item b2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b3"
And I click on grade item menu "Item b3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b4"
And I click on grade item menu "Item b4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
Scenario: Switching a category from Natural aggregation to Weighted mean of grades and back
Given I follow "Edit Course 1"
Given I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Weighted mean of grades"
When I press "Save changes"
And I follow "Edit Item a1"
And I press "Save changes"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
Then I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Cat mean"
And I click on grade category menu "Cat mean"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Cat median"
And I click on grade category menu "Cat median"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Cat min"
And I click on grade category menu "Cat min"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Cat natural &"
And I click on grade category menu "Cat natural &"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Weighted mean of grades"
And I press "Save changes"
And I follow "Edit Item b1"
And I click on grade item menu "Item b1"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Item b2"
And I click on grade item menu "Item b2"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Item b3"
And I click on grade item menu "Item b3"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
And I follow "Edit Item b4"
And I click on grade item menu "Item b4"
And I choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted"
And I should not see "Extra credit"
And the field "Item weight" matches value "1"
And I press "Cancel"
# Switching back.
And I follow "Edit Course 1"
Given I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat mean"
And I click on grade category menu "Cat mean"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat median"
And I click on grade category menu "Cat median"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat min"
And I click on grade category menu "Cat min"
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Cat natural &"
And I click on grade category menu "Cat natural &"
And I choose "Edit category" in the open action menu
And I set the field "Aggregation" to "Natural"
And I press "Save changes"
And I follow "Edit Item b1"
And I click on grade item menu "Item b1"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b2"
And I click on grade item menu "Item b2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b3"
And I click on grade item menu "Item b3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item b4"
And I click on grade item menu "Item b4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
@ -342,21 +405,25 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I should not see "Cat natural &amp;" in the "select#menumoveafter" "css_element"
When I select "Cat natural &" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
Then the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1"
And I press "Cancel"
@ -368,16 +435,20 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Cat ec" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
# Move to Simple weight mean of grades.
@ -388,16 +459,20 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Cat simple" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
# Move to Weighted mean of grades.
@ -408,19 +483,23 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Cat weighted" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "2"
And I press "Save changes"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "5"
And I press "Save changes"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "8"
And I press "Save changes"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1"
And I set the field "Item weight" to "11"
And I press "Save changes"
@ -433,16 +512,20 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I select "Cat weighted2" from the "Move selected items to" singleselect
And I wait "2" seconds
And I navigate to "View > Grader report" in the course gradebook
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "2"
And I press "Save changes"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "5"
And I press "Save changes"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "8"
And I press "Save changes"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "11"
And I press "Save changes"
# Move back to Natural.
@ -453,19 +536,23 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I set the field "Select Item a4" to "1"
And I select "Course 1" from the "Move selected items to" singleselect
And I navigate to "View > Grader report" in the course gradebook
And I follow "Edit Item a1"
And I click on grade item menu "Item a1"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a2"
And I click on grade item menu "Item a2"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a3"
And I click on grade item menu "Item a3"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"
And I follow "Edit Item a4"
And I click on grade item menu "Item a4"
And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0"
And I press "Cancel"

View File

@ -130,6 +130,7 @@ Feature: Editing a grade item
And I set the field "Maximum grade" to "87#50"
When I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I follow "Single view for Student 1"
And I click on user menu "Student 1"
And I choose "Single view for this user" in the open action menu
Then I should see "Student 1"
And the field "Grade for Category total" matches value "17#50"

View File

@ -50,7 +50,9 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment three"
And I press "Save changes"
And I set the following settings for grade item "Test assignment four":
And I click on grade item menu "Test assignment four"
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Hidden | 1 |
And I press "Save changes"
And I am on "Course 1" course homepage

View File

@ -39,5 +39,5 @@ Feature: We can customise the letter boundary of a course.
And I am on "Course 1" course homepage with editing mode off
And I navigate to "View > Grader report" in the course gradebook
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- |
| Student 1 | D | D |
| -1- | -1- |-3- | -4- |
| Student 1 | student1@example.com | D | D |

View File

@ -40,5 +40,5 @@ Feature: We can customise the letter boundary of a course in gradebook version 2
And I am on "Course 1" course homepage with editing mode off
And I navigate to "View > Grader report" in the course gradebook
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- |
| Student 1 | F | F |
| -1- | -1- | -3- | -4- |
| Student 1 | student1@example.com | F | F |

View File

@ -75,12 +75,12 @@ Feature: View gradebook when scales are used
Scenario: Test displaying scales in gradebook in aggregation method Natural
When I turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- |
| Student 1 | A | 5.00 | 5.00 |
| Student 2 | B | 4.00 | 4.00 |
| Student 3 | C | 3.00 | 3.00 |
| Student 4 | D | 2.00 | 2.00 |
| Student 5 | F | 1.00 | 1.00 |
| -1- | -1- | -3- | -4- | -5- |
| Student 1 | student1@example.com | A | 5.00 | 5.00 |
| Student 2 | student2@example.com | B | 4.00 | 4.00 |
| Student 3 | student3@example.com | C | 3.00 | 3.00 |
| Student 4 | student4@example.com | D | 2.00 | 2.00 |
| Student 5 | student5@example.com | F | 1.00 | 1.00 |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | FA | 0.005.00 | 0.005.00 |
@ -109,24 +109,27 @@ Feature: View gradebook when scales are used
| Course total | 4.00 | 05 | 80.00 % | - |
Scenario Outline: Test displaying scales in gradebook in all other aggregation methods
When I follow "Edit Course 1"
And I set the field "Aggregation" to "<aggregation>"
Given I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | <aggregation> |
And I press "Save changes"
And I follow "Edit Sub category 1"
And I expand all fieldsets
And I set the field "Aggregation" to "<aggregation>"
And I set the field "Category name" to "Sub category (<aggregation>)"
And I set the field "Maximum grade" to "5"
And I set the field "Minimum grade" to "1"
And I click on grade category menu "Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | <aggregation> |
| Category name | Sub category (<aggregation>) |
| Maximum grade | 5 |
| Minimum grade | 1 |
And I press "Save changes"
And I turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- |
| Student 1 | A | 5.00 | <coursetotal1> |
| Student 2 | B | 4.00 | <coursetotal2> |
| Student 3 | C | 3.00 | <coursetotal3> |
| Student 4 | D | 2.00 | <coursetotal4> |
| Student 5 | F | 1.00 | <coursetotal5> |
| -1- | -1- | -3- | -4- | -5- |
| Student 1 | student1@example.com | A | 5.00 | <coursetotal1> |
| Student 2 | student2@example.com | B | 4.00 | <coursetotal2> |
| Student 3 | student3@example.com | C | 3.00 | <coursetotal3> |
| Student 4 | student4@example.com | D | 2.00 | <coursetotal4> |
| Student 5 | student5@example.com | F | 1.00 | <coursetotal5> |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | FA | 1.005.00 | 0.00100.00 |

View File

@ -44,8 +44,11 @@ Feature: Control the aggregation of the scales
When I give the grade "10" to the user "Student 1" for the grade item "Grade me"
And I give the grade "B" to the user "Student 1" for the grade item "Scale me"
And I press "Save changes"
And I set the following settings for grade item "Course 1":
When I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | <aggregation> |
And I press "Save changes"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
@ -85,8 +88,11 @@ Feature: Control the aggregation of the scales
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
When I set the following settings for grade item "Course 1":
When I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | Natural |
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Override weight of Grade me" to "1"
Then the field "Override weight of Grade me" matches value "100.00"

View File

@ -33,10 +33,10 @@ Feature: View gradebook when single item scales are used
| student2 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 | C1 |
| <span lang='en' class='multilang'>EN</span><span lang='fr' class='multilang'>FR</span> Sub category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory |
| assign | C1 | a1 | Test assignment one | Submit something! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 |
| assign | C1 | a1 | Test assignment one | Submit something! | <span lang='en' class='multilang'>EN</span><span lang='fr' class='multilang'>FR</span> Sub category 1 |
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I am on the "Test assignment one" "assign activity editing" page logged in as teacher1
@ -59,8 +59,8 @@ Feature: View gradebook when single item scales are used
Scenario: Test displaying single item scales in gradebook in aggregation method Natural
When I turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- |
| Student 1 | Ace! | 1.00 | 1.00 |
| -1- | -1- | -3- | -4- | -5- |
| Student 1 | student1@example.com | Ace! | 1.00 | 1.00 |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | Ace!Ace! | 0.001.00 | 0.001.00 |
@ -68,37 +68,40 @@ Feature: View gradebook when single item scales are used
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | Ace! | Ace!Ace! | 100.00 % |
| EN Sub category 1 total| 1.00 | 01 | - |
| Course total | 1.00 | 01 | - |
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | Ace! | Ace!Ace! | 100.00 % |
| ENFR Sub category 1 total | 1.00 | 01 | - |
| Course total | 1.00 | 01 | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | - | Ace!Ace! | - |
| EN Sub category 1 total| - | 01 | - |
| Course total | - | 01 | - |
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | - | Ace!Ace! | - |
| ENFR Sub category 1 total | - | 01 | - |
| Course total | - | 01 | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | 1.00 |
| EN Sub category 1 total| 1.00 |
| Course total | 1.00 |
| Name | Max grade |
| Test assignment one | 1.00 |
| ENFR Sub category 1 total | 1.00 |
| Course total | 1.00 |
Scenario Outline: Test displaying single item scales in gradebook in all other aggregation methods
When I follow "Edit Course 1"
And I set the field "Aggregation" to "<aggregation>"
Given I click on course grade category menu "Course 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | <aggregation> |
And I press "Save changes"
And I follow "Edit EN Sub category 1"
And I click on grade category menu "<span lang='en' class='multilang'>EN</span><span lang='fr' class='multilang'>FR</span> Sub category 1"
And I choose "Edit category" in the open action menu
And I set the following fields to these values:
| Aggregation | <aggregation> |
| Category name | Sub category (<aggregation>) |
And I press "Save changes"
And I turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -4- | -5- | -6- |
| Student 1 | Ace! | <cattotal1> | <coursetotal1> |
| Student 2 | - | - | - |
| -1- | -1- | -3- | -4- | -5- |
| Student 1 | student1@example.com | Ace! | <cattotal1> | <coursetotal1> |
| Student 2 | student2@example.com | - | - | - |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | Ace!Ace! | 0.00100.0 | 0.00100.00 |

View File

@ -62,7 +62,8 @@ Feature: We can set the grade to pass value
| Grade to pass | 25 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit assign Test Assignment 1" "link"
And I click on grade item menu "Test Assignment 1"
And I choose "Edit grade item" in the open action menu
Then the field "Grade to pass" matches value "25"
And I am on "Course 1" course homepage
And I am on the "Test Assignment 1" "assign activity" page
@ -71,7 +72,8 @@ Feature: We can set the grade to pass value
And I set the field "Grade to pass" to "30"
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit assign Test Assignment 1" "link"
And I click on grade item menu "Test Assignment 1"
And I choose "Edit grade item" in the open action menu
And the field "Grade to pass" matches value "30"
Scenario: Set a valid grade to pass for an assignment activity using scales
@ -84,7 +86,8 @@ Feature: We can set the grade to pass value
| Grade to pass | 3 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit assign Test Assignment 1" "link"
And I click on grade item menu "Test Assignment 1"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "3"
And I set the field "Grade to pass" to "4"
@ -118,12 +121,14 @@ Feature: We can set the grade to pass value
| Assessment grade to pass | 10 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit workshop Test Workshop 1 (submission)" "link"
And I click on grade item menu "Test Workshop 1 (submission)"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "40"
And I set the field "Grade to pass" to "45"
And I press "Save changes"
And I click on "Edit workshop Test Workshop 1 (assessment)" "link"
And I click on grade item menu "Test Workshop 1 (assessment)"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
And the field "Grade to pass" matches value "10"
And I set the field "Grade to pass" to "15"
@ -158,7 +163,8 @@ Feature: We can set the grade to pass value
| Grade to pass | 9.5 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit quiz Test Quiz 1" "link"
And I click on grade item menu "Test Quiz 1"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "9.5"
And I set the field "Grade to pass" to "8"
@ -178,7 +184,8 @@ Feature: We can set the grade to pass value
| Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit lesson Test Lesson 1" "link"
And I click on grade item menu "Test Lesson 1"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
@ -199,7 +206,8 @@ Feature: We can set the grade to pass value
| Grade to pass | 90#50 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit lesson Test Lesson 1" "link"
And I click on grade item menu "Test Lesson 1"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90#50"
And I set the field "Grade to pass" to "80"
@ -221,7 +229,8 @@ Feature: We can set the grade to pass value
| Ratings > Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit data Test Database 1" "link"
And I click on grade item menu "Test Database 1"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
@ -261,7 +270,8 @@ Feature: We can set the grade to pass value
| Ratings > Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit forum Test Forum 1 rating" "link"
And I click on grade item menu "Test Forum 1 rating"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
@ -284,7 +294,8 @@ Feature: We can set the grade to pass value
| Ratings > Grade to pass | 90 |
And I press "Save and return to course"
And I navigate to "View > Grader report" in the course gradebook
And I click on "Edit glossary Test Glossary 1" "link"
And I click on grade item menu "Test Glossary 1"
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"

View File

@ -82,3 +82,7 @@ showanalysisicon,core_grades
showanalysisicon_desc,core_grades
showanalysisicon_help,core_grades
blockunprotect,core_admin
showactivityicons,core_grades
showactivityicons_help,core_grades
showcalculations,core_grades
showcalculations_help,core_grades

View File

@ -48,7 +48,7 @@ $string['aggregateonlygraded_help'] = 'An empty grade is a grade which is missin
This setting determines whether empty grades are not included in the aggregation or are counted as minimal grades, for example 0 for an assignment graded between 0 and 100.';
$string['aggregateoutcomes'] = 'Include outcomes in aggregation';
$string['aggregateoutcomes_help'] = 'If enabled, outcomes are included in the aggregation. This may result in an unexpected category total.';
$string['aggregatesonly'] = 'Change to aggregates only';
$string['aggregatesonly'] = 'Show totals only';
$string['aggregatesum'] = 'Natural';
$string['aggregateweightedmean'] = 'Weighted mean of grades';
$string['aggregateweightedmean2'] = 'Simple weighted mean of grades';
@ -125,7 +125,6 @@ $string['compact'] = 'Compact';
$string['componentcontrolsvisibility'] = 'Whether this grade item is hidden is controlled by the activity settings.';
$string['contract'] = 'Contract category';
$string['contributiontocoursetotal'] = 'Contribution to course total';
$string['controls'] = 'Controls';
$string['courseavg'] = 'Course average';
$string['coursegradecategory'] = 'Course grade category';
$string['coursegradedisplaytype'] = 'Course grade display type';
@ -251,7 +250,7 @@ $string['forceon'] = 'Force: On';
$string['forelementtypes'] = 'for the selected {$a}';
$string['forstudents'] = 'For students';
$string['full'] = 'Full';
$string['fullmode'] = 'Change to full view';
$string['fullmode'] = 'Show grades and totals';
$string['generalsettings'] = 'General settings';
$string['grade'] = 'Grade';
$string['grade_help'] = 'The grade to award the student for their work.';
@ -348,8 +347,7 @@ $string['gradereport'] = 'Grade report';
$string['graderreport'] = 'Grader report';
$string['grades'] = 'Grades';
$string['gradesforuser'] = 'Grades for {$a->user}';
$string['singleview'] = 'Single view for {$a}';
$string['gradesonly'] = 'Change to grades only';
$string['gradesonly'] = 'Show grades only';
$string['gradesmoduledeletionpendingwarning'] = 'Warning: Activity deletion in progress! Some grades are about to be removed.';
$string['gradesmoduledeletionprefix'] = '[Deletion in progress]';
$string['gradessettings'] = 'Grade settings';
@ -761,8 +759,8 @@ $string['showfeedback'] = 'Show feedback';
$string['showfeedback_help'] = 'Whether to show a column for feedback.';
$string['showgrade'] = 'Show grades';
$string['showgrade_help'] = 'Whether to show a column for grades.';
$string['showingaggregatesonly'] = 'Showing aggregates only';
$string['showingfullmode'] = 'Showing full view';
$string['showingaggregatesonly'] = 'Showing totals only';
$string['showingfullmode'] = 'Showing grades and totals';
$string['showinggradesonly'] = 'Showing grades only';
$string['showlettergrade'] = 'Show letter grades';
$string['showlettergrade_help'] = 'Whether to show a column for letter grades.';
@ -772,15 +770,11 @@ $string['showweight'] = 'Show weightings';
$string['showweight_help'] = 'Whether to show a column for the grade weight.';
$string['rangedecimals'] = 'Range decimal places';
$string['rangedecimals_help'] = 'The number of decimal places to display for the range.';
$string['showactivityicons'] = 'Show activity icons';
$string['showactivityicons_help'] = 'If enabled, activity icons are shown next to activity names.';
$string['showallgrades'] = 'Show all grades';
$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.
@ -915,3 +909,8 @@ $string['showquickfeedback_help'] = 'If enabled, when editing is turned on, a fe
Note that when feedback is edited in the grader report, an overridden flag is set, meaning that the feedback can no longer be changed from within the related activity.';
$string['enableajax'] = 'Enable AJAX';
$string['enableajax_help'] = 'Adds a layer of AJAX functionality to the grader report, simplifying and speeding up common operations. Depends on Javascript being switched on at the user\'s browser level.';
$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.';

View File

@ -27,17 +27,11 @@ Feature: Turn editing mode on
And I am on "Course 1" course homepage
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And "Edit assign Test Assignment 1" "link" should exist
And I click on grade item menu "Test Assignment 1"
And "Edit grade item" "link" should exist
And I turn editing mode off
Then "Edit assign Test Assignment 1" "link" should not exist
Scenario: Edit mode on page Course
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I turn editing mode on
And I should see "Add an activity or resource"
And I turn editing mode off
Then I should not see "Add an activity or resource"
And I click on grade item menu "Test Assignment 1"
Then "Edit grade item" "link" should not exist
Scenario: Edit mode on page Homepage
Given I log in as "admin"

View File

@ -66,7 +66,8 @@ Feature: I can grade a students interaction across a forum
But I should not see "Test Forum 1 rating"
# The values saved should be reflected here.
Given I click on "Edit forum Test Forum 1 whole forum" "link"
And I click on grade item menu "Test Forum 1 whole forum"
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
Then the field "Grade to pass" matches value "4"
@ -121,7 +122,8 @@ Feature: I can grade a students interaction across a forum
But I should not see "Test Forum 1 whole forum"
# The values saved should be reflected here.
Given I click on "Edit forum Test Forum 1 rating" "link"
And I click on grade item menu "Test Forum 1 rating"
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
Then the field "Grade to pass" matches value "4"
@ -157,14 +159,16 @@ Feature: I can grade a students interaction across a forum
And I should see "Test Forum 1 whole forum"
# The values saved should be reflected here.
Given I click on "Edit forum Test Forum 1 rating" "link"
And I click on grade item menu "Test Forum 1 rating"
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "100"
Then the field "Grade to pass" matches value "40"
And I should see "Peers" in the "Parent category" "fieldset"
And I press "cancel"
Given I click on "Edit forum Test Forum 1 whole forum" "link"
And I click on grade item menu "Test Forum 1 whole forum"
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
Then the field "Grade to pass" matches value "4"

View File

@ -520,7 +520,6 @@
tr.lastrow {
position: sticky;
bottom: 0;
z-index: 1;
td,
th {
@ -531,6 +530,7 @@
th.header {
position: sticky;
left: -3rem;
z-index: 1;
}
td.noborder {

View File

@ -34972,7 +34972,6 @@ p.arrow_button {
.path-grade-report-grader .gradeparent tr.lastrow {
position: sticky;
bottom: 0;
z-index: 1;
}
.path-grade-report-grader .gradeparent tr.lastrow td,
.path-grade-report-grader .gradeparent tr.lastrow th {
@ -34981,6 +34980,7 @@ p.arrow_button {
.path-grade-report-grader .gradeparent th.header {
position: sticky;
left: -3rem;
z-index: 1;
}
.path-grade-report-grader .gradeparent td.noborder {
border-right: transparent;

View File

@ -34972,7 +34972,6 @@ p.arrow_button {
.path-grade-report-grader .gradeparent tr.lastrow {
position: sticky;
bottom: 0;
z-index: 1;
}
.path-grade-report-grader .gradeparent tr.lastrow td,
.path-grade-report-grader .gradeparent tr.lastrow th {
@ -34981,6 +34980,7 @@ p.arrow_button {
.path-grade-report-grader .gradeparent th.header {
position: sticky;
left: -3rem;
z-index: 1;
}
.path-grade-report-grader .gradeparent td.noborder {
border-right: transparent;