Merge branch 'MDL-77033-master-3' of https://github.com/ilyatregubov/moodle

This commit is contained in:
Jake Dallimore
2023-03-31 11:29:45 +08:00
54 changed files with 1264 additions and 1207 deletions
@@ -330,22 +330,22 @@ Feature: Set up contextual data for tests
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
Then I should see "Test Grade Item 1"
And I open the action menu in "Test Grade Item 1" "table_row"
And I choose "Edit" in the open action menu
And I click on grade item menu "Test Grade Item 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
And I should see "Course 1"
And I press "Cancel"
And I should see "Grade category 1"
And I should see "Test Grade Item 2"
And I open the action menu in "Test Grade Item 2" "table_row"
And I choose "Edit" in the open action menu
And I click on grade item menu "Test Grade Item 2" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
And I should see "Grade category 1"
And I press "Cancel"
And I should see "Grade sub category 2"
And I should see "Test Grade Item 3"
And I open the action menu in "Test Grade Item 3" "table_row"
And I choose "Edit" in the open action menu
And I click on grade item menu "Test Grade Item 3" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I expand all fieldsets
And I should see "Grade sub category 2"
And I press "Cancel"
@@ -410,8 +410,8 @@ Feature: Set up contextual data for tests
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
Then I should see "Test Outcome Grade Item 1"
And I open the action menu in "Test Outcome Grade Item 1" "table_row"
And I choose "Edit" in the open action menu
And I click on grade item menu "Test Outcome Grade Item 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And the field "Outcome" matches value "Grade outcome 1"
And I expand all fieldsets
And I should see "Grade category 1" in the "Grade category" "form_row"
@@ -59,7 +59,7 @@ Feature: Students will be shown relevant completion state based on grade item vi
Scenario: Passing grade and receive a grade completions for hidden grade item (passgrade completion enabled)
Given I am on the "Course 1" course page logged in as teacher1
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I hide the grade item "Test assignment name"
And I hide the grade item "Test assignment name" of type "gradeitem" on "setup" page
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "21" to the user "Student First" for the grade item "Test assignment name"
@@ -119,7 +119,7 @@ Feature: Students will be shown relevant completion state based on grade item vi
And I log out
And I am on the "Course 1" course page logged in as teacher1
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I hide the grade item "Test assignment name"
And I hide the grade item "Test assignment name" of type "gradeitem" on "setup" page
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "21" to the user "Student First" for the grade item "Test assignment name"
+1 -3
View File
@@ -247,7 +247,7 @@ if (grade_regrade_final_grades_if_required($course, $grade_edit_tree_index_check
$actionbar = new \core_grades\output\gradebook_setup_action_bar($context);
print_grade_page_head($courseid, 'settings', 'setup', get_string('gradebooksetup', 'grades'),
false, false, true, null, null, null, $actionbar);
false, false, true, null, null, null, $actionbar, false);
// Print Table of categories and items
echo $OUTPUT->box_start('gradetreebox generalbox');
@@ -292,5 +292,3 @@ $PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['grade
echo $OUTPUT->footer();
die;
+87 -50
View File
@@ -66,6 +66,7 @@ class grade_edit_tree {
}
$this->columns[] = grade_edit_tree_column::factory('range'); // This is not a setting... How do we deal with it?
$this->columns[] = grade_edit_tree_column::factory('status');
$this->columns[] = grade_edit_tree_column::factory('actions');
if ($this->deepest_level > 1) {
@@ -104,7 +105,7 @@ class grade_edit_tree {
$object = $element['object'];
$eid = $element['eid'];
$object->name = $this->gtree->get_element_header($element, true, false, true, true, true);
$object->name = $this->gtree->get_element_header($element, true, false, true, false, true);
$object->icon = $this->gtree->get_element_icon($element);
$object->type = $this->gtree->get_element_type_string($element);
$object->stripped_name = $this->gtree->get_element_header($element, false, false, false);
@@ -119,54 +120,13 @@ class grade_edit_tree {
}
$moveaction = '';
$actionsmenu = new action_menu();
$actionsmenu->set_menu_trigger($OUTPUT->pix_icon('i/moremenu', get_string('actions')), 'actions');
$actionsmenu->set_owner_selector('grade-item-' . $eid);
if (!$is_category_item && ($icon = $this->gtree->get_edit_icon($element, $this->gpr, true))) {
$actionsmenu->add($icon);
}
// MDL-49281 if grade_item already has calculation, it should be editable even if global setting is off.
$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 || $icon) {
$actionsmenu->add($icon);
}
$actions = $this->gtree->get_cell_action_menu($element, 'setup', $this->gpr);
if ($element['type'] == 'item' or ($element['type'] == 'category' and $element['depth'] > 1)) {
if ($this->element_deletable($element)) {
$aurl = new moodle_url('index.php', array('id' => $COURSE->id, 'action' => 'delete', 'eid' => $eid, 'sesskey' => sesskey()));
$icon = new action_menu_link_secondary($aurl, new pix_icon('t/delete', get_string('delete')), get_string('delete'));
$actionsmenu->add($icon);
}
if ($this->element_duplicatable($element)) {
$duplicateparams = array();
$duplicateparams['id'] = $COURSE->id;
$duplicateparams['action'] = 'duplicate';
$duplicateparams['eid'] = $eid;
$duplicateparams['sesskey'] = sesskey();
$aurl = new moodle_url('index.php', $duplicateparams);
$duplicateicon = new pix_icon('t/copy', get_string('duplicate'));
$icon = new action_menu_link_secondary($aurl, $duplicateicon, get_string('duplicate'));
$actionsmenu->add($icon);
}
$aurl = new moodle_url('index.php', array('id' => $COURSE->id, 'action' => 'moveselect', 'eid' => $eid, 'sesskey' => sesskey()));
$moveaction .= $OUTPUT->action_icon($aurl, new pix_icon('t/move', get_string('move')));
}
if ($icon = $this->gtree->get_hiding_icon($element, $this->gpr, true)) {
$actionsmenu->add($icon);
}
if ($icon = $this->gtree->get_reset_icon($element, $this->gpr, true)) {
$actionsmenu->add($icon);
}
$actions = $OUTPUT->render($actionsmenu);
$returnrows = array();
$root = false;
@@ -205,8 +165,6 @@ class grade_edit_tree {
$item = $category->get_grade_item();
// Add aggregation coef input if not a course item and if parent category has correct aggregation type
$dimmed = ($item->is_hidden()) ? 'dimmed_text' : '';
// Before we print the category's row, we must find out how many rows will appear below it (for the filler cell's rowspan)
$aggregation_position = grade_get_setting($COURSE->id, 'aggregationposition', $CFG->grade_aggregationposition);
$category_total_data = null; // Used if aggregationposition is set to "last", so we can print it last
@@ -315,7 +273,7 @@ class grade_edit_tree {
$categoryrow = new html_table_row();
$categoryrow->id = 'grade-item-' . $eid;
$categoryrow->attributes['class'] = $courseclass . ' category ' . $dimmed;
$categoryrow->attributes['class'] = $courseclass . ' category ';
$categoryrow->attributes['data-category'] = $eid;
$categoryrow->attributes['data-itemid'] = $category->get_grade_item()->id;
$categoryrow->attributes['data-hidden'] = 'false';
@@ -373,10 +331,9 @@ class grade_edit_tree {
$categoryitemclass = 'courseitem';
}
$dimmed = ($item->is_hidden()) ? "dimmed_text" : "";
$gradeitemrow = new html_table_row();
$gradeitemrow->id = 'grade-item-' . $eid;
$gradeitemrow->attributes['class'] = $categoryitemclass . ' item ' . $dimmed;
$gradeitemrow->attributes['class'] = $categoryitemclass . ' item ';
$gradeitemrow->attributes['data-itemid'] = $object->id;
$gradeitemrow->attributes['data-hidden'] = 'false';
// If this item is a course or category aggregation, add a data attribute that stores the identifier of
@@ -486,7 +443,7 @@ class grade_edit_tree {
* @param array $element
* @return bool
*/
function element_deletable($element) {
public static function element_deletable($element) {
global $COURSE;
if ($element['type'] != 'item') {
@@ -514,7 +471,7 @@ class grade_edit_tree {
* @param array $element
* @return bool
*/
public function element_duplicatable($element) {
public static function element_duplicatable($element) {
if ($element['type'] != 'item') {
return false;
}
@@ -1010,6 +967,86 @@ class grade_edit_tree_column_range extends grade_edit_tree_column {
}
}
/**
* Class grade_edit_tree_column_status
*
* @package core_grades
* @copyright 2023 Ilya Tregubov <[email protected]>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class grade_edit_tree_column_status extends grade_edit_tree_column {
/**
* Get status column header cell
* @return html_table_cell status column header cell
*/
public function get_header_cell() {
$headercell = clone($this->headercell);
$headercell->text = get_string('status');
return $headercell;
}
/**
* Get category cell in status column
*
* @param grade_category $category grade category
* @param string $levelclass Category level info
* @param array $params Params (category id, action performed etc)
* @return html_table_cell category cell in status columns
*/
public function get_category_cell($category, $levelclass, $params) {
global $OUTPUT, $gtree;
$categorycell = parent::get_category_cell($category, $levelclass, $params);
$element = [];
$element['object'] = $category;
$categorycell->text = $gtree->set_grade_status_icons($element);
// Aggregation type.
$aggrstrings = grade_helper::get_aggregation_strings();
$context = new stdClass();
$context->aggregation = $aggrstrings[$category->aggregation];
// Include/exclude empty grades.
if ($category->aggregateonlygraded) {
$context->aggregateonlygraded = $category->aggregateonlygraded;
}
// Aggregate outcomes.
if ($category->aggregateoutcomes) {
$context->aggregateoutcomes = $category->aggregateoutcomes;
}
// Drop the lowest.
if ($category->droplow) {
$context->droplow = $category->droplow;
}
// Keep the highest.
if ($category->keephigh) {
$context->keephigh = $category->keephigh;
}
$categorycell->text .= $OUTPUT->render_from_template('core_grades/category_settings', $context);
return $categorycell;
}
/**
* Get category cell in status column
*
* @param grade_item $item grade item
* @param array $params Params
* @return html_table_cell item cell in status columns
*/
public function get_item_cell($item, $params) {
global $gtree;
$element = [];
$element['object'] = $item;
$itemcell = parent::get_item_cell($item, $params);
$itemcell->text = $gtree->set_grade_status_icons($element);
return $itemcell;
}
}
/**
* Class grade_edit_tree_column_actions
*
+304 -37
View File
@@ -1704,9 +1704,13 @@ class grade_structure {
*
* @param grade_grade $grade
* @return string
* @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_grade_analysis_icon(grade_grade $grade) {
global $OUTPUT;
debugging('The function get_grade_analysis_icon() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
$url = $this->get_grade_analysis_url($grade);
if (is_null($url)) {
@@ -1722,15 +1726,15 @@ class grade_structure {
* Returns a link leading to the grade analysis page
*
* @param grade_grade $grade
* @param string $gradeanalysisstring Language string
* @return string|null
*/
public function get_grade_analysis_link(grade_grade $grade, string $gradeanalysisstring): ?string {
public function get_grade_analysis_link(grade_grade $grade): ?string {
$url = $this->get_grade_analysis_url($grade);
if (is_null($url)) {
return null;
}
$gradeanalysisstring = grade_helper::get_lang_string('gradeanalysis', 'grades');
return html_writer::link($url, $gradeanalysisstring,
['class' => 'dropdown-item', 'aria-label' => $gradeanalysisstring, 'role' => 'menuitem']);
}
@@ -1831,9 +1835,13 @@ class grade_structure {
* @param object $gpr A grade_plugin_return object
* @param bool $returnactionmenulink return the instance of action_menu_link instead of string
* @return string|action_menu_link
* @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_reset_icon($element, $gpr, $returnactionmenulink = false) {
global $CFG, $OUTPUT;
debugging('The function get_reset_icon() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
// Limit to category items set to use the natural weights aggregation method, and users
// with the capability to manage grades.
@@ -1858,6 +1866,81 @@ class grade_structure {
}
}
/**
* Returns a link to reset weights for the given element.
*
* @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_reset_weights_link(array $element, object $gpr): ?string {
// Limit to category items set to use the natural weights aggregation method, and users
// with the capability to manage grades.
if ($element['type'] != 'category' || $element['object']->aggregation != GRADE_AGGREGATE_SUM ||
!has_capability('moodle/grade:manage', $this->context)) {
return null;
}
$title = grade_helper::get_lang_string('resetweightsshort', 'grades');
$str = get_string('resetweights', 'grades', $this->get_params_for_iconstr($element));
$url = new moodle_url('/grade/edit/tree/action.php', [
'id' => $this->courseid,
'action' => 'resetweights',
'eid' => $element['eid'],
'sesskey' => sesskey(),
]);
$gpr->add_url_params($url);
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $str, 'role' => 'menuitem']);
}
/**
* Returns a link to delete a given element.
*
* @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_delete_link(array $element, object $gpr): ?string {
if ($element['type'] == 'item' || ($element['type'] == 'category' && $element['depth'] > 1)) {
if (grade_edit_tree::element_deletable($element)) {
$url = new moodle_url('index.php',
['id' => $this->courseid, 'action' => 'delete', 'eid' => $element['eid'], 'sesskey' => sesskey()]);
$title = grade_helper::get_lang_string('delete');
$gpr->add_url_params($url);
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
}
}
return null;
}
/**
* Returns a link to duplicate a given element.
*
* @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_duplicate_link(array $element, object $gpr): ?string {
if ($element['type'] == 'item' || ($element['type'] == 'category' && $element['depth'] > 1)) {
if (grade_edit_tree::element_duplicatable($element)) {
$duplicateparams = [];
$duplicateparams['id'] = $this->courseid;
$duplicateparams['action'] = 'duplicate';
$duplicateparams['eid'] = $element['eid'];
$duplicateparams['sesskey'] = sesskey();
$url = new moodle_url('index.php', $duplicateparams);
$title = grade_helper::get_lang_string('duplicate');
$gpr->add_url_params($url);
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
}
}
return null;
}
/**
* Return edit icon for give element
*
@@ -1865,10 +1948,15 @@ class grade_structure {
* @param object $gpr A grade_plugin_return object
* @param bool $returnactionmenulink return the instance of action_menu_link instead of string
* @return string|action_menu_link
* @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_edit_icon($element, $gpr, $returnactionmenulink = false) {
global $CFG, $OUTPUT;
debugging('The function get_edit_icon() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
if (!has_capability('moodle/grade:manage', $this->context)) {
if ($element['type'] == 'grade' and has_capability('moodle/grade:edit', $this->context)) {
// oki - let them override grade
@@ -1945,10 +2033,9 @@ class grade_structure {
*
* @param array $element An array representing an element in the grade_tree
* @param object $gpr A grade_plugin_return object
* @param array $langstrings Language strings
* @return string|null
*/
public function get_edit_link(array $element, object $gpr, array $langstrings): ?string {
public function get_edit_link(array $element, object $gpr): ?string {
$url = null;
$title = '';
if ((!has_capability('moodle/grade:manage', $this->context) &&
@@ -1967,7 +2054,7 @@ class grade_structure {
['courseid' => $this->courseid, 'id' => $object->id]);
}
$url = $gpr->add_url_params($url);
$title = $langstrings[0];
$title = grade_helper::get_lang_string('editgrade', 'grades');
} else if (($element['type'] == 'item') || ($element['type'] == 'categoryitem') ||
($element['type'] == 'courseitem')) {
if (empty($object->outcomeid) || empty($CFG->enableoutcomes)) {
@@ -1978,12 +2065,12 @@ class grade_structure {
['courseid' => $this->courseid, 'id' => $object->id]);
}
$url = $gpr->add_url_params($url);
$title = $langstrings[1];
$title = grade_helper::get_lang_string('itemsedit', 'grades');
} 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];
$title = grade_helper::get_lang_string('categoryedit', 'grades');
}
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
@@ -2053,9 +2140,13 @@ class grade_structure {
* @param object $gpr A grade_plugin_return object
* @param bool $returnactionmenulink return the instance of action_menu_link instead of string
* @return string|action_menu_link
* @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_hiding_icon($element, $gpr, $returnactionmenulink = false) {
global $CFG, $OUTPUT;
debugging('The function get_hiding_icon() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
if (!$element['object']->can_control_visibility()) {
return $returnactionmenulink ? null : '';
@@ -2109,10 +2200,9 @@ class grade_structure {
*
* @param array $element An array representing an element in the grade_tree
* @param object $gpr A grade_plugin_return object
* @param array $langstrings Language strings
* @return string|null
*/
public function get_hiding_link(array $element, object $gpr, array $langstrings): ?string {
public function get_hiding_link(array $element, object $gpr): ?string {
if (!$element['object']->can_control_visibility() || !has_capability('moodle/grade:manage', $this->context) ||
!has_capability('moodle/grade:hide', $this->context)) {
return null;
@@ -2124,10 +2214,10 @@ class grade_structure {
if ($element['object']->is_hidden()) {
$url->param('action', 'show');
$title = $langstrings[0];
$title = grade_helper::get_lang_string('show');
} else {
$url->param('action', 'hide');
$title = $langstrings[1];
$title = grade_helper::get_lang_string('hide');
}
$url = html_writer::link($url, $title,
@@ -2154,9 +2244,13 @@ class grade_structure {
* @param object $gpr A grade_plugin_return object
*
* @return string
* @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_locking_icon($element, $gpr) {
global $CFG, $OUTPUT;
debugging('The function get_locking_icon() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
$strparams = $this->get_params_for_iconstr($element);
$strunlock = get_string('unlockverbose', 'grades', $strparams);
@@ -2209,11 +2303,10 @@ class grade_structure {
*
* @param array $element An array representing an element in the grade_tree
* @param object $gpr A grade_plugin_return object
* @param array $langstrings Language strings
*
* @return string|null
*/
public function get_locking_link(array $element, object $gpr, array $langstrings): ?string {
public function get_locking_link(array $element, object $gpr): ?string {
if (has_capability('moodle/grade:manage', $this->context) && isset($element['object'])) {
$title = '';
@@ -2226,19 +2319,19 @@ class grade_structure {
$strparamobj = new stdClass();
$strparamobj->itemname = $element['object']->grade_item->get_name(true, true);
$strnonunlockable = get_string('nonunlockableverbose', 'grades', $strparamobj);
$title = $langstrings[0];
$title = grade_helper::get_lang_string('unlock', 'grades');
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];
$title = grade_helper::get_lang_string('unlock', 'grades');
$url->param('action', 'unlock');
} else {
return null;
}
} else {
if (has_capability('moodle/grade:lock', $this->context)) {
$title = $langstrings[1];
$title = grade_helper::get_lang_string('lock', 'grades');
$url->param('action', 'lock');
} else {
return null;
@@ -2259,9 +2352,14 @@ class grade_structure {
* @param object $gpr A grade_plugin_return object
* @param bool $returnactionmenulink return the instance of action_menu_link instead of string
* @return string|action_menu_link
* @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_calculation_icon($element, $gpr, $returnactionmenulink = false) {
global $CFG, $OUTPUT;
debugging('The function get_calculation_icon() is deprecated, please do not use it anymore.',
DEBUG_DEVELOPER);
if (!has_capability('moodle/grade:manage', $this->context)) {
return $returnactionmenulink ? null : '';
}
@@ -2304,12 +2402,10 @@ class grade_structure {
*
* @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 {
public function get_edit_calculation_link(array $element, object $gpr): ?string {
if (has_capability('moodle/grade:manage', $this->context) && isset($element['object'])) {
$object = $element['object'];
@@ -2318,32 +2414,199 @@ class grade_structure {
// Show calculation icon only when calculation possible.
if (!$object->is_external_item() && ($isscale || $isvalue)) {
$editcalculationstring = grade_helper::get_lang_string('editcalculation', 'grades');
$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 html_writer::link($url, $editcalculationstring,
['class' => 'dropdown-item', 'aria-label' => $editcalculationstring, 'role' => 'menuitem']);
}
}
return null;
}
/**
* Returns link to change category view mode.
* Sets status icons for the grade.
*
* @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
* @param array $element array with grade item info
* @return string status icons container HTML
*/
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']);
public function set_grade_status_icons(array $element): string {
global $OUTPUT;
$attributes = ['class' => 'text-muted'];
$statusicons = '';
if ($element['object']->is_hidden()) {
$statusicons .= $OUTPUT->pix_icon('i/show', grade_helper::get_lang_string('hidden', 'grades'),
'moodle', $attributes);
}
if ($element['object']->is_locked()) {
$statusicons .= $OUTPUT->pix_icon('i/lock', grade_helper::get_lang_string('locked', 'grades'),
'moodle', $attributes);
}
if ($element['object'] instanceof grade_grade) {
$grade = $element['object'];
if ($grade->is_overridden()) {
$statusicons .= $OUTPUT->pix_icon('i/overriden_grade',
grade_helper::get_lang_string('overridden', 'grades'), 'moodle', $attributes);
}
if ($grade->is_excluded()) {
$statusicons .= $OUTPUT->pix_icon('i/excluded', grade_helper::get_lang_string('excluded', 'grades'),
'moodle', $attributes);
}
}
$class = 'grade_icons';
if (isset($element['type']) && ($element['type'] == 'category')) {
$class = 'category_grade_icons';
}
if ($statusicons) {
$statusicons = $OUTPUT->container($statusicons, $class);
}
return $statusicons;
}
/**
* Returns an action menu for the grade.
*
* @param array $element Array with cell info.
* @param string $mode Mode - gradeitem or user
* @param grade_plugin_return $gpr
* @param moodle_url|null $baseurl
* @return string
*/
public function get_cell_action_menu(array $element, string $mode, grade_plugin_return $gpr,
?moodle_url $baseurl = null): string {
global $OUTPUT, $USER;
$context = new stdClass();
if ($mode == 'gradeitem' || $mode == 'setup') {
$editable = true;
if ($element['type'] == 'grade') {
$item = $element['object']->grade_item;
if ($item->is_course_item() || $item->is_category_item()) {
$editable = (bool)get_config('moodle', 'grade_overridecat');;
}
if (!empty($USER->editing)) {
if ($editable) {
$context->editurl = $this->get_edit_link($element, $gpr);
}
$context->hideurl = $this->get_hiding_link($element, $gpr);
$context->lockurl = $this->get_locking_link($element, $gpr);
}
$context->gradeanalysisurl = $this->get_grade_analysis_link($element['object']);
} else if (($element['type'] == 'item') || ($element['type'] == 'categoryitem') ||
($element['type'] == 'courseitem') || ($element['type'] == 'userfield')) {
$context->datatype = 'item';
if ($element['type'] == 'item') {
if ($mode == 'setup') {
$context->deleteurl = $this->get_delete_link($element, $gpr);
$context->duplicateurl = $this->get_duplicate_link($element, $gpr);
} else {
$context =
grade_report::get_additional_context($this->context, $this->courseid,
$element, $gpr, $mode, $context, true);
$context->advancedgradingurl = $this->get_advanced_grading_link($element, $gpr);
}
}
if ($element['type'] == 'item') {
$context->divider1 = true;
}
if (!empty($USER->editing) || $mode == 'setup') {
if (($element['type'] !== 'userfield') && ($mode !== 'setup')) {
$context->divider1 = true;
$context->divider2 = true;
}
if ($element['type'] == 'item') {
$context->editurl = $this->get_edit_link($element, $gpr);
}
$context->editcalculationurl =
$this->get_edit_calculation_link($element, $gpr);
if (isset($element['object'])) {
$object = $element['object'];
if ($object->itemmodule !== 'quiz') {
$context->hideurl = $this->get_hiding_link($element, $gpr);
}
}
$context->lockurl = $this->get_locking_link($element, $gpr);
}
// Sorting item.
if ($baseurl) {
$sortlink = $baseurl;
if (isset($element['object']->id)) {
$sortlink->param('sortitemid', $element['object']->id);
} else if ($element['type'] == 'userfield') {
$context->datatype = $element['name'];
$sortlink->param('sortitemid', $element['name']);
}
if (($element['type'] == 'userfield') && ($element['name'] == 'fullname')) {
$sortlink->param('sortitemid', 'firstname');
$context->ascendingfirstnameurl = $this->get_sorting_link($sortlink, $gpr);
$context->descendingfirstnameurl = $this->get_sorting_link($sortlink, $gpr, 'desc');
$sortlink->param('sortitemid', 'lastname');
$context->ascendinglastnameurl = $this->get_sorting_link($sortlink, $gpr);
$context->descendinglastnameurl = $this->get_sorting_link($sortlink, $gpr, 'desc');
} else {
$context->ascendingurl = $this->get_sorting_link($sortlink, $gpr);
$context->descendingurl = $this->get_sorting_link($sortlink, $gpr, 'desc');
}
}
} else if ($element['type'] == 'category') {
$context->datatype = 'category';
if ($mode !== 'setup') {
$mode = 'category';
$context = grade_report::get_additional_context($this->context, $this->courseid,
$element, $gpr, $mode, $context);
} else {
$context->deleteurl = $this->get_delete_link($element, $gpr);
$context->resetweightsurl = $this->get_reset_weights_link($element, $gpr);
}
if (!empty($USER->editing) || $mode == 'setup') {
if ($mode !== 'setup') {
$context->divider1 = true;
}
$context->editurl = $this->get_edit_link($element, $gpr);
$context->hideurl = $this->get_hiding_link($element, $gpr);
$context->lockurl = $this->get_locking_link($element, $gpr);
}
}
if (isset($element['object'])) {
$context->dataid = $element['object']->id;
} else if ($element['type'] == 'userfield') {
$context->dataid = $element['name'];
}
} else if ($mode == 'user') {
$context->datatype = 'user';
$context = grade_report::get_additional_context($this->context, $this->courseid, $element, $gpr, $mode, $context, true);
$context->dataid = $element['userid'];
}
if (!empty($USER->editing) || isset($context->gradeanalysisurl) || isset($context->gradesonlyurl)
|| isset($context->aggregatesonlyurl) || isset($context->fullmodeurl) || isset($context->reporturl0)
|| isset($context->ascendingfirstnameurl) || isset($context->ascendingurl) || ($mode == 'setup')) {
return $OUTPUT->render_from_template('core_grades/cellmenu', $context);
}
return '';
}
/**
@@ -2351,11 +2614,16 @@ class grade_structure {
*
* @param moodle_url $sortlink A base link for sorting
* @param object $gpr A grade_plugin_return object
* @param string $title Language string
* @param string $direction Direction od sorting
* @return string
*/
public function get_sorting_link(moodle_url $sortlink, object $gpr, string $title, string $direction = 'asc'): string {
public function get_sorting_link(moodle_url $sortlink, object $gpr, string $direction = 'asc'): string {
if ($direction == 'asc') {
$title = grade_helper::get_lang_string('asc');
} else {
$title = grade_helper::get_lang_string('desc');
}
$sortlink->param('sort', $direction);
$gpr->add_url_params($sortlink);
@@ -3649,4 +3917,3 @@ abstract class grade_helper {
self::$aggregationstrings = null;
}
}
+90 -233
View File
@@ -658,7 +658,8 @@ class grade_report_grader extends grade_report {
$studentheader->header = true;
$studentheader->id = 'studentheader';
$element = ['type' => 'userfield', 'name' => 'fullname'];
$studentheader->text = $arrows['studentname'] . $this->get_cell_action_menu($element, 'gradeitem');
$studentheader->text = $arrows['studentname'] .
$this->gtree->get_cell_action_menu($element, 'gradeitem', $this->gpr, $this->baseurl);
$headerrow->cells[] = $studentheader;
@@ -668,7 +669,8 @@ class grade_report_grader extends grade_report {
$fieldheader->scope = 'col';
$fieldheader->header = true;
$element = ['type' => 'userfield', 'name' => $field];
$fieldheader->text = $arrows[$field] . $this->get_cell_action_menu($element, 'gradeitem');
$fieldheader->text = $arrows[$field] .
$this->gtree->get_cell_action_menu($element, 'gradeitem', $this->gpr, $this->baseurl);
$headerrow->cells[] = $fieldheader;
}
@@ -714,7 +716,7 @@ 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');
$usercell->text .= $this->gtree->get_cell_action_menu(['userid' => $userid], 'user', $this->gpr);
$userrow->cells[] = $usercell;
@@ -751,7 +753,8 @@ class grade_report_grader extends grade_report {
$this->rowcount = 0;
$numusers = count($this->users);
$gradetabindex = 1;
$strgrade = $this->get_lang_string('gradenoun');
$strgrade = \grade_helper::get_lang_string('gradenoun');
$this->get_sort_arrows();
// Get preferences once.
$quickgrading = $this->get_pref('quickgrading');
@@ -809,7 +812,7 @@ class grade_report_grader extends grade_report {
$categorycell->header = true;
$categorycell->scope = 'col';
$statusicons = $this->set_grade_status_icons($element);
$statusicons = $this->gtree->set_grade_status_icons($element);
if ($statusicons) {
$categorycell->text .= $statusicons;
$categorycell->attributes['class'] .= ' statusicons';
@@ -837,8 +840,8 @@ class grade_report_grader extends grade_report {
' highlightable'. ' i'. $element['object']->id;
$itemcell->attributes['data-itemid'] = $element['object']->id;
$singleview = $this->get_cell_action_menu($element, 'gradeitem');
$statusicons = $this->set_grade_status_icons($element);
$singleview = $this->gtree->get_cell_action_menu($element, 'gradeitem', $this->gpr, $this->baseurl);
$statusicons = $this->gtree->set_grade_status_icons($element);
if ($statusicons) {
$itemcell->attributes['class'] .= ' statusicons';
}
@@ -967,7 +970,7 @@ class grade_report_grader extends grade_report {
$gradepass = '';
$context->gradepassicon = '';
}
$context->statusicons = $this->set_grade_status_icons($element);
$context->statusicons = $this->gtree->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.
@@ -1007,9 +1010,9 @@ class grade_report_grader extends grade_report {
if ($quickgrading && $grade->is_editable()) {
$context->iseditable = true;
if (empty($item->outcomeid)) {
$nogradestr = $this->get_lang_string('nograde');
$nogradestr = \grade_helper::get_lang_string('nograde');
} else {
$nogradestr = $this->get_lang_string('nooutcome', 'grades');
$nogradestr = \grade_helper::get_lang_string('nooutcome', 'grades');
}
$attributes = [
'tabindex' => $tabindices[$item->id]['grade'],
@@ -1092,7 +1095,7 @@ class grade_report_grader extends grade_report {
}
if (!$item->needsupdate) {
$context->actionmenu = $this->get_cell_action_menu($element, 'gradeitem');
$context->actionmenu = $this->gtree->get_cell_action_menu($element, 'gradeitem', $this->gpr);
}
$itemcell->text = $OUTPUT->render_from_template('gradereport_grader/cell', $context);
@@ -1120,51 +1123,6 @@ class grade_report_grader extends grade_report {
return $rows;
}
/**
* Sets status icons for the grade.
* @param array $element array with grade item info
*
* @return string status icons container HTML
*/
public function set_grade_status_icons(array $element) : string {
global $OUTPUT;
$attributes = ['class' => 'text-muted'];
$statusicons = '';
if ($element['object']->is_hidden()) {
$statusicons .= $OUTPUT->pix_icon('i/show', $this->get_lang_string('hidden', 'grades'),
'moodle', $attributes);
}
if ($element['object']->is_locked()) {
$statusicons .= $OUTPUT->pix_icon('i/lock', $this->get_lang_string('locked', '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);
}
}
$class = 'grade_icons';
if ($element['type'] == 'category') {
$class = 'category_grade_icons';
}
if ($statusicons) {
$statusicons = $OUTPUT->container($statusicons, $class);
}
return $statusicons;
}
/**
* Depending on the style of report (fixedstudents vs traditional one-table),
* arranges the rows of data in one or two tables, and returns the output of
@@ -1218,7 +1176,7 @@ class grade_report_grader extends grade_report {
$controlscell->attributes['class'] = 'header controls';
$controlscell->header = true;
$controlscell->colspan = $colspan;
$controlscell->text = $this->get_lang_string('controls', 'grades');
$controlscell->text = \grade_helper::get_lang_string('controls', 'grades');
$controlsrow->cells[] = $controlscell;
$rows[] = $controlsrow;
@@ -1243,7 +1201,7 @@ class grade_report_grader extends grade_report {
$rangecell->colspan = $colspan;
$rangecell->header = true;
$rangecell->scope = 'row';
$rangecell->text = $this->get_lang_string('range', 'grades');
$rangecell->text = \grade_helper::get_lang_string('range', 'grades');
$rangerow->cells[] = $rangecell;
$rows[] = $rangerow;
}
@@ -1547,7 +1505,7 @@ class grade_report_grader extends grade_report {
* @return string HTML
*/
protected function get_course_header($element) {
$actionmenu = $this->get_cell_action_menu($element, 'gradeitem');
$actionmenu = $this->gtree->get_cell_action_menu($element, 'gradeitem', $this->gpr);
if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
$showing = get_string('showingaggregatesonly', 'grades');
@@ -1628,179 +1586,6 @@ class grade_report_grader extends grade_report {
return $OUTPUT->container($editicon.$editcalculationicon.$showhideicon.$lockunlockicon.$gradeanalysisicon, 'grade_icons');
}
/**
* 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_cell_action_menu(array $element, string $mode): string {
global $OUTPUT, $USER, $CFG;
$context = new stdClass();
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');
$editcalculationstrings = $this->get_lang_string('editcalculation', 'grades');
$hidestrings = [];
$hidestrings[] = $this->get_lang_string('show');
$hidestrings[] = $this->get_lang_string('hide');
$lockstrings = [];
$lockstrings[] = $this->get_lang_string('unlock', 'grades');
$lockstrings[] = $this->get_lang_string('lock', 'grades');
$gradeanalysisstring = $this->get_lang_string('gradeanalysis', 'grades');
$titleasc = $this->get_lang_string('asc');
$titledesc = $this->get_lang_string('desc');
if ($element['type'] == 'grade') {
$item = $element['object']->grade_item;
if ($item->is_course_item() || $item->is_category_item()) {
$editable = $this->overridecat;
}
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') ||
($element['type'] == 'userfield')) {
$context->datatype = 'item';
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 ($element['type'] == 'item') {
$context->divider1 = true;
}
if (!empty($USER->editing)) {
if ($element['type'] !== 'userfield') {
$context->divider1 = true;
$context->divider2 = 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);
if (isset($element['object'])) {
$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);
}
// Sorting item.
$sortlink = clone($this->baseurl);
if (isset($element['object']->id)) {
$sortlink->param('sortitemid', $element['object']->id);
} else if ($element['type'] == 'userfield') {
$context->datatype = $element['name'];
$sortlink->param('sortitemid', $element['name']);
}
if (($element['type'] == 'userfield') && ($element['name'] == 'fullname')) {
$sortlink->param('sortitemid', 'firstname');
$context->ascendingfirstnameurl = $this->gtree->get_sorting_link($sortlink, $this->gpr, $titleasc);
$context->descendingfirstnameurl = $this->gtree->get_sorting_link($sortlink, $this->gpr, $titledesc, 'desc');
$sortlink->param('sortitemid', 'lastname');
$context->ascendinglastnameurl = $this->gtree->get_sorting_link($sortlink, $this->gpr, $titleasc);
$context->descendinglastnameurl = $this->gtree->get_sorting_link($sortlink, $this->gpr, $titledesc, 'desc');
} else {
$context->ascendingurl = $this->gtree->get_sorting_link($sortlink, $this->gpr, $titleasc);
$context->descendingurl = $this->gtree->get_sorting_link($sortlink, $this->gpr, $titledesc, 'desc');
}
} else if ($element['type'] == 'category') {
$context->datatype = '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->divider1 = 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);
}
}
if (isset($element['object'])) {
$context->dataid = $element['object']->id;
} else if ($element['type'] == 'userfield') {
$context->dataid = $element['name'];
}
} else if ($mode == 'user') {
$context->datatype = '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) || isset($context->gradesonlyurl)
|| isset($context->aggregatesonlyurl) || isset($context->fullmodeurl) || isset($context->reporturl0)
|| isset($context->ascendingurl) || isset($context->ascendingfirstnameurl)) {
return $OUTPUT->render_from_template('gradereport_grader/cellmenu', $context);
}
return '';
}
/**
* Given a category element returns collapsing +/- icon if available
*
@@ -2034,7 +1819,7 @@ class grade_report_grader extends grade_report {
if (!empty($requirednames)) {
foreach ($requirednames as $name) {
$arrows['studentname'] .= html_writer::link(
new moodle_url($this->baseurl, array('sortitemid' => $name)), $this->get_lang_string($name)
new moodle_url($this->baseurl, array('sortitemid' => $name)), \grade_helper::get_lang_string($name)
);
if ($this->sortitemid == $name) {
$sortlink->param('sortitemid', $name);
@@ -2080,4 +1865,76 @@ class grade_report_grader extends grade_report {
// Default to the lowest available option.
return (int) get_user_preferences('grade_report_studentsperpage', min(static::PAGINATION_OPTIONS));
}
/**
* 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']);
}
}
/**
* Adds report specific context variable
*
* @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 Not used
* @param stdClass|null $templatecontext Template context
* @return stdClass|null
*/
function gradereport_grader_get_report_link(context_course $context, int $courseid,
array $element, grade_plugin_return $gpr, string $mode, ?stdClass $templatecontext): ?stdClass {
if ($mode == 'category') {
static $report = null;
if (!$report) {
$report = new grade_report_grader($courseid, $gpr, $context);
}
if (!isset($templatecontext)) {
$templatecontext = new stdClass();
}
$categoryid = $element['object']->id;
// Load language strings.
$strswitchminus = grade_helper::get_lang_string('aggregatesonly', 'grades');
$strswitchplus = grade_helper::get_lang_string('gradesonly', 'grades');
$strswitchwhole = grade_helper::get_lang_string('fullmode', 'grades');
$url = new moodle_url($gpr->get_return_url(null, ['target' => $element['eid'], 'sesskey' => sesskey()]));
$gradesonly = false;
$aggregatesonly = false;
$fullmode = false;
if (in_array($categoryid, $report->collapsed['gradesonly'])) {
$gradesonly = true;
} else if (in_array($categoryid, $report->collapsed['aggregatesonly'])) {
$aggregatesonly = true;
} else {
$fullmode = true;
}
$templatecontext->gradesonlyurl =
$report->get_category_view_mode_link($url, $strswitchplus, 'switch_plus', $gradesonly);
$templatecontext->aggregatesonlyurl =
$report->get_category_view_mode_link($url, $strswitchminus, 'switch_minus', $aggregatesonly);
$templatecontext->fullmodeurl =
$report->get_category_view_mode_link($url, $strswitchwhole, 'switch_whole', $fullmode);
return $templatecontext;
}
return null;
}
@@ -58,6 +58,8 @@ class behat_gradereport_grader extends behat_base {
/**
* Gets the grade item id from its name.
*
* @deprecated since 4.2
* @todo MDL-77107 This will be deleted in Moodle 4.6.
* @throws Exception
* @param string $itemname
* @return int
@@ -66,6 +68,9 @@ class behat_gradereport_grader extends behat_base {
global $DB;
debugging('behat_gradereport_grader::get_grade_item_id() is deprecated, please use' .
' behat_grades::get_grade_item_id() instead.', DEBUG_DEVELOPER);
if ($id = $DB->get_field('grade_items', 'id', array('itemname' => $itemname))) {
return $id;
}
@@ -88,134 +93,6 @@ 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-type='item'][@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-type='category'][@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-type='category'][@data-id='" . $itemid . "']";
}
/**
* Clicks on given user menu.
*
@@ -50,14 +50,14 @@ Feature: We can sort grades/user fields on the grader report
And "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
# Sort by grades in descending order.
And I click on grade item menu "Test assignment name 1"
And I click on grade item menu "Test assignment name 1" of type "gradeitem" on "grader" page
And I choose "Descending" in the open action menu
And I wait until the page is ready
Then "StudentA 2" "table_row" should appear before "StudentC 3" "table_row"
And "StudentC 3" "table_row" should appear before "StudentB 4" "table_row"
And "StudentB 4" "table_row" should appear before "StudentD 1" "table_row"
# Sort by grades in ascending order.
And I click on grade item menu "Test assignment name 1"
And I click on grade item menu "Test assignment name 1" of type "gradeitem" on "grader" page
And I choose "Ascending" in the open action menu
And I wait until the page is ready
Then "StudentD 1" "table_row" should appear before "StudentB 4" "table_row"
@@ -50,7 +50,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -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 click on grade item menu "Course 1" of type "course" on "grader" page
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"
@@ -59,7 +59,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -1- | -1- | -3- |
| Student 1 | student1@example.com | 170 |
And I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I click on "Show grades only" "link"
And I should see "Test assignment name 1"
And I should see "Test assignment name 2"
@@ -90,7 +90,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -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 click on grade item menu "Course 1" of type "course" on "grader" page
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"
@@ -99,7 +99,7 @@ Feature: We can change what we are viewing on the grader report
And the following should exist in the "user-grades" table:
| -1- | -1- | -3- |
| Student 1 | student1@example.com | 105.71 |
And I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
And I click on "Show grades only" "link"
And I should see "Test assignment name 1"
And I should see "Test assignment name 2"
+28 -20
View File
@@ -92,12 +92,6 @@ abstract class grade_report {
*/
public $page;
/**
* Array of cached language strings (using get_string() all the time takes a long time!).
* @var array $lang_strings
*/
public $lang_strings = array();
// GROUP VARIABLES (including SQL)
/**
@@ -307,37 +301,51 @@ abstract class grade_report {
abstract public function process_action($target, $action);
/**
* Returns an array of links to appropriate report pages for the current element
* Add additional links specific to plugin
* @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
* @param string $mode Mode (user or grade item)
* @param stdClass $templatecontext Template context
* @param bool $otherplugins If we need to insert links to other plugins
* @return ?stdClass Updated template context
*/
public function get_report_links(context_course $context, int $courseid, array $element,
grade_plugin_return $gpr, string $mode): array {
public static function get_additional_context(context_course $context, int $courseid, array $element,
grade_plugin_return $gpr, string $mode, stdClass $templatecontext, bool $otherplugins = false): ?stdClass {
$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;
if (!$otherplugins) {
$component = 'gradereport_' . $gpr->plugin;
$params = [$context, $courseid, $element, $gpr, $mode, $templatecontext];
return component_callback($component, 'get_report_link', $params);
} else {
// Loop through all installed grade reports.
foreach (core_component::get_plugin_list('gradereport') as $plugin => $plugindir) {
$params = [$context, $courseid, $element, $gpr, $mode, $templatecontext];
$component = 'gradereport_' . $plugin;
$templatecontextupdated = component_callback($component, 'get_report_link', $params);
if ($templatecontextupdated) {
$templatecontext = $templatecontextupdated;
}
}
return $templatecontext;
}
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.
*
* @deprecated since 4.2
* @todo MDL-77307 This will be deleted in Moodle 4.6.
* @param string $strcode
* @param string $section Optional language section
* @return string
*/
public function get_lang_string($strcode, $section=null) {
debugging('grade_report::get_lang_string() is deprecated, please use' .
' grade_helper::get_lang_string() instead.', DEBUG_DEVELOPER);
if (empty($this->lang_strings[$strcode])) {
$this->lang_strings[$strcode] = get_string($strcode, $section);
}
@@ -588,7 +596,7 @@ abstract class grade_report {
global $OUTPUT;
$pix = ['up' => 't/sort_desc', 'down' => 't/sort_asc'];
$matrix = ['up' => 'desc', 'down' => 'asc'];
$strsort = $this->get_lang_string($matrix[$direction], 'moodle');
$strsort = grade_helper::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]);
}
+5 -5
View File
@@ -151,13 +151,13 @@ class grade_report_overview extends grade_report {
// setting up table headers
if ($this->showrank['any']) {
$tablecolumns = array('coursename', 'grade', 'rank');
$tableheaders = array($this->get_lang_string('coursename', 'grades'),
$this->get_lang_string('gradenoun'),
$this->get_lang_string('rank', 'grades'));
$tableheaders = array(grade_helper::get_lang_string('coursename', 'grades'),
grade_helper::get_lang_string('gradenoun'),
grade_helper::get_lang_string('rank', 'grades'));
} else {
$tablecolumns = array('coursename', 'grade');
$tableheaders = array($this->get_lang_string('coursename', 'grades'),
$this->get_lang_string('gradenoun'));
$tableheaders = array(grade_helper::get_lang_string('coursename', 'grades'),
grade_helper::get_lang_string('gradenoun'));
}
$this->table = new flexible_table('grade-report-overview-'.$this->user->id);
+1 -1
View File
@@ -24,7 +24,7 @@ namespace gradereport_overview;
* @covers \grade_report_overview
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class lib_test extends \externallib_advanced_testcase {
class lib_test extends \advanced_testcase {
/**
* Require the library file we're about to test, and other requirements.
+10 -4
View File
@@ -30,12 +30,16 @@
* @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
* @param ?stdClass $templatecontext Template context
* @return stdClass|null
*/
function gradereport_singleview_get_report_link(context_course $context, int $courseid,
array $element, grade_plugin_return $gpr, string $mode): ?string {
array $element, grade_plugin_return $gpr, string $mode, ?stdClass $templatecontext): ?stdClass {
$reportstring = grade_helper::get_lang_string('singleviewreport_' . $mode, 'gradereport_singleview');
if (!isset($templatecontext)) {
$templatecontext = new stdClass();
}
if ($mode == 'gradeitem') {
// View all grades items.
@@ -50,8 +54,9 @@ function gradereport_singleview_get_report_link(context_course $context, int $co
'itemid' => $element['object']->id
]);
$gpr->add_url_params($url);
return html_writer::link($url, $reportstring,
$templatecontext->reporturl0 = html_writer::link($url, $reportstring,
['class' => 'dropdown-item', 'aria-label' => $reportstring, 'role' => 'menuitem']);
return $templatecontext;
}
}
} else if ($mode == 'user') {
@@ -66,8 +71,9 @@ function gradereport_singleview_get_report_link(context_course $context, int $co
$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,
$templatecontext->reporturl0 = html_writer::link($url, $reportstring,
['class' => 'dropdown-item', 'aria-label' => $reportstring, 'role' => 'menuitem']);
return $templatecontext;
}
}
return null;
@@ -33,7 +33,7 @@ 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 click on grade item menu "Test assignment one"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
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"
@@ -61,7 +61,7 @@ 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 click on grade item menu "Test assignment one"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
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"
@@ -125,7 +125,7 @@ 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 click on grade item menu "Test assignment one"
And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
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"
@@ -106,7 +106,7 @@ 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 click on grade item menu "Test assignment one"
Given I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page
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
+4 -1
View File
@@ -11,12 +11,15 @@ information provided here is intended especially for developers.
* '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.
* A new method grade_report::get_additional_context() 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
* The setting $CFG->grade_report_studentsperpage has been completely removed because it's not required anymore. This setting
was used to set the default number of students displayed per page in the grader report. Now the default is set to
20.
* The get_grade_item_id() function in behat_gradereport_grader.php has been deprecated. Please use
behat_grades::get_grade_item_id() instead.
* The grade_report::get_lang_string() has been deprecated. Please use grade_helper::get_lang_string() instead.
=== 3.6 ===
* External function gradereport_user_external::get_grade_items now return the following information (only for course managers).
+13 -11
View File
@@ -27,7 +27,9 @@ use moodle_url;
defined('MOODLE_INTERNAL') || die;
global $CFG;
require_once($CFG->dirroot.'/grade/report/lib.php');
require_once($CFG->dirroot.'/grade/lib.php');
/**
* Class providing an API for the user report building and displaying.
@@ -373,51 +375,51 @@ class user extends grade_report {
// Setting up table headers.
$this->tablecolumns = ['itemname'];
$this->tableheaders = [$this->get_lang_string('gradeitem', 'grades')];
$this->tableheaders = [\grade_helper::get_lang_string('gradeitem', 'grades')];
if ($this->showweight) {
$this->tablecolumns[] = 'weight';
$this->tableheaders[] = $this->get_lang_string('weightuc', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('weightuc', 'grades');
}
if ($this->showgrade) {
$this->tablecolumns[] = 'grade';
$this->tableheaders[] = $this->get_lang_string('grade', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('grade', 'grades');
}
if ($this->showrange) {
$this->tablecolumns[] = 'range';
$this->tableheaders[] = $this->get_lang_string('range', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('range', 'grades');
}
if ($this->showpercentage) {
$this->tablecolumns[] = 'percentage';
$this->tableheaders[] = $this->get_lang_string('percentage', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('percentage', 'grades');
}
if ($this->showlettergrade) {
$this->tablecolumns[] = 'lettergrade';
$this->tableheaders[] = $this->get_lang_string('lettergrade', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('lettergrade', 'grades');
}
if ($this->showrank) {
$this->tablecolumns[] = 'rank';
$this->tableheaders[] = $this->get_lang_string('rank', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('rank', 'grades');
}
if ($this->showaverage) {
$this->tablecolumns[] = 'average';
$this->tableheaders[] = $this->get_lang_string('average', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('average', 'grades');
}
if ($this->showfeedback) {
$this->tablecolumns[] = 'feedback';
$this->tableheaders[] = $this->get_lang_string('feedback', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('feedback', 'grades');
}
if ($this->showcontributiontocoursetotal) {
$this->tablecolumns[] = 'contributiontocoursetotal';
$this->tableheaders[] = $this->get_lang_string('contributiontocoursetotal', 'grades');
$this->tableheaders[] = \grade_helper::get_lang_string('contributiontocoursetotal', 'grades');
}
}
@@ -1008,7 +1010,7 @@ class user extends grade_report {
$table = new \html_table();
$table->attributes = [
'summary' => s($this->get_lang_string('tablesummary', 'gradereport_user')),
'summary' => s(\grade_helper::get_lang_string('tablesummary', 'gradereport_user')),
'class' => 'generaltable boxaligncenter user-grade',
];
+9 -3
View File
@@ -247,15 +247,20 @@ function gradereport_user_myprofile_navigation(tree $tree, stdClass $user, bool
* @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
* @param ?stdClass $templatecontext Template context
* @return stdClass|null
*/
function gradereport_user_get_report_link(context_course $context, int $courseid, array $element,
grade_plugin_return $gpr, string $mode): ?string {
grade_plugin_return $gpr, string $mode, ?stdClass $templatecontext): ?stdClass {
global $CFG;
if ($mode == 'user') {
$reportstring = grade_helper::get_lang_string('userreport_' . $mode, 'gradereport_user');
if (!isset($templatecontext)) {
$templatecontext = new stdClass();
}
// 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')) {
@@ -266,8 +271,9 @@ function gradereport_user_get_report_link(context_course $context, int $courseid
$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,
$templatecontext->reporturl1 = html_writer::link($url, $reportstring,
['class' => 'dropdown-item', 'aria-label' => $reportstring, 'role' => 'menuitem']);
return $templatecontext;
}
}
return null;
@@ -34,8 +34,8 @@ Feature: View the user report as the student will see it
And the "multilang" filter applies to "content and headings"
When I am on the "C1" "Course" page logged in as "teacher1"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I hide the grade item "Test assignment six"
And I hide the grade item "Sub category 2"
And I hide the grade item "Test assignment six" of type "gradeitem" on "setup" page
And I hide the grade item "Sub category 2" of type "category" on "setup" page
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I change window size to "large"
@@ -0,0 +1,56 @@
{{!
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 core_grades/cellmenu
This template renders action menu for a given cell.
Example context (json):
{
"aggregation": "Natural",
"aggregateonlygraded": 1,
"aggregateoutcomes": 0,
"droplow": 1,
"keephigh": 1
}
}}
<div class="card-deck" role="list">
{{#aggregation}}
<span class="badge badge-pill badge-light" role="listitem">
<strong>{{aggregation}}</strong>
</span>
{{/aggregation}}
{{#aggregateonlygraded}}
<span class="badge badge-pill badge-light" role="listitem">
<strong>{{#str}}aggregateonlygraded, grades{{/str}}</strong>
</span>
{{/aggregateonlygraded}}
{{#aggregateoutcomes}}
<span class="badge badge-pill badge-light" role="listitem">
<strong>{{#str}}aggregateoutcomes, grades{{/str}}</strong>
</span>
{{/aggregateoutcomes}}
{{#droplow}}
<span class="badge badge-pill badge-light" role="listitem">
<strong>{{#str}}droplowestvalues, grades, {{droplow}}{{/str}}</strong>
</span>
{{/droplow}}
{{#keephigh}}
<span class="badge badge-pill badge-light" role="listitem">
<strong>{{#str}}keephigh, grades{{/str}}</strong>
</span>
{{/keephigh}}
</div>
@@ -15,7 +15,7 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template gradereport_grader/cellmenu
@template core_grades/cellmenu
This template renders action menu for a given cell.
Example context (json):
@@ -31,8 +31,8 @@
"ascendinglastnameurl": "<a class='dropdown-item' aria-label='Ascending' role='menuitem' href='index.php?id=13&amp;sortitemid=lastname&amp;sort=asc&amp;gpr_type=report&amp;gpr_plugin=grader&amp;gpr_courseid=13'>Ascending</a>",
"descendinglastnameurl": "<a class='dropdown-item' aria-label='Descending' role='menuitem' href='index.php?id=13&amp;sortitemid=lastname&amp;sort=desc&amp;gpr_type=report&amp;gpr_plugin=grader&amp;gpr_courseid=13'>Descending</a>",
"divider1": "true",
"divider2": "true"
"datatype": item,
"divider2": "true",
"datatype": "item",
"dataid": "123"
}
}}
@@ -48,14 +48,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}}
{{#advancedgradingurl}}{{{advancedgradingurl}}}{{/advancedgradingurl}}
{{#deleteurl}}{{{deleteurl}}}{{/deleteurl}}
{{#duplicateurl}}{{{duplicateurl}}}{{/duplicateurl}}
{{#gradeanalysisurl}}{{{gradeanalysisurl}}}{{/gradeanalysisurl}}
{{#divider1}}
<div class="dropdown-divider" role="separator"></div>
{{/divider1}}
@@ -76,6 +77,7 @@
{{/divider2}}
{{#hideurl}}{{{hideurl}}}{{/hideurl}}
{{#lockurl}}{{{lockurl}}}{{/lockurl}}
{{#resetweightsurl}}{{{resetweightsurl}}}{{/resetweightsurl}}
</div>
</div>
</div>
+41 -75
View File
@@ -51,54 +51,51 @@ class behat_grade extends behat_base {
*
* Teacher must be either on the grade setup page or on the Grader report page with editing mode turned on.
*
* @Given /^I set the following settings for grade item "(?P<grade_item_string>(?:[^"]|\\")*)":$/
* @Given /^I set the following settings for grade item "(?P<grade_item_string>(?:[^"]|\\")*)" of type "([^"]*)" on "([^"]*)" page:$/
* @param string $gradeitem
* @param string $type
* @param string $page
* @param TableNode $data
*/
public function i_set_the_following_settings_for_grade_item($gradeitem, TableNode $data) {
$gradeitem = behat_context_helper::escape($gradeitem);
public function i_set_the_following_settings_for_grade_item(string $gradeitem, string $type, string $page, TableNode $data) {
if ($this->running_javascript()) {
$xpath = "//tr[contains(.,$gradeitem)]//*[contains(@class,'moodle-actionmenu')][not(contains(@class,'grader'))]";
if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
$this->execute("behat_action_menu::i_open_the_action_menu_in",
array("//tr[contains(.,$gradeitem)]",
"xpath_element"));
}
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, $type, $page]);
}
$savechanges = get_string('savechanges', 'grades');
$edit = behat_context_helper::escape(get_string('edit') . ' ');
$linkxpath = "//a[./*[contains(concat(' ', normalize-space(@class), ' '), ' icon ') " .
"and starts-with(@title,$edit) and contains(@title,$gradeitem)]]";
if ($type == 'gradeitem') {
$linktext = get_string('itemsedit', 'grades');
} else if ($type == 'category') {
$linktext = get_string('categoryedit', 'grades');
} else {
$linktext = get_string('categoryedit', 'grades');
}
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $linktext);
$this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element"));
$savechanges = get_string('savechanges', 'grades');
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data);
$this->execute('behat_forms::press_button', $this->escape($savechanges));
}
/**
* Hids a grade item or category.
* Hids a grade item or category on gradebook setup or grader page.
*
* Teacher must be on the grade setup page.
*
* @Given /^I hide the grade item "(?P<grade_item_string>(?:[^"]|\\")*)"$/
* @Given /^I hide the grade item "(?P<grade_item_string>(?:[^"]|\\")*)" of type "([^"]*)" on "([^"]*)" page$/
* @param string $gradeitem
* @param string $type
* @param string $page
*/
public function i_hide_the_grade_item($gradeitem) {
public function i_hide_the_grade_item(string $gradeitem, string $type, string $page) {
$gradeitem = behat_context_helper::escape($gradeitem);
$linktext = get_string('hide');
if ($this->running_javascript()) {
$xpath = "//tr[contains(.,$gradeitem)]//*[contains(@class,'moodle-actionmenu')]//a[contains(@class,'dropdown-toggle')]";
if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, $type, $page]);
}
$this->execute("behat_general::i_click_on_in_the", array(get_string('hide'), 'link',
"//tr[descendant::*[text() = " . $this->escape($gradeitem) . "]]", 'xpath_element'));
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $linktext);
}
/**
@@ -109,19 +106,14 @@ class behat_grade extends behat_base {
* @Given /^I duplicate the grade item "(?P<grade_item_string>(?:[^"]|\\")*)"$/
* @param string $gradeitem
*/
public function i_duplicate_the_grade_item($gradeitem) {
$gradeitem = behat_context_helper::escape($gradeitem);
public function i_duplicate_the_grade_item(string $gradeitem) {
$linktext = get_string('duplicate');
if ($this->running_javascript()) {
$xpath = "//tr[contains(.,$gradeitem)]//*[contains(@class,'moodle-actionmenu')]//a[contains(@class,'dropdown-toggle')]";
if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
$this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
}
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, 'gradeitem', 'setup']);
}
$this->execute("behat_general::i_click_on_in_the", array(get_string('duplicate'), 'link',
"//tr[descendant::*[text() = " . $this->escape($gradeitem) . "]]", 'xpath_element'));
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $linktext);
}
/**
@@ -135,23 +127,14 @@ class behat_grade extends behat_base {
*/
public function i_set_calculation_for_grade_item_with_idnumbers($calculation, $gradeitem, TableNode $data) {
$gradeitem = behat_context_helper::escape($gradeitem);
$edit = get_string('editcalculation', 'grades');
if ($this->running_javascript()) {
$xpath = "//tr[contains(.,$gradeitem)]//*[contains(@class,'moodle-actionmenu')]";
if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
$this->execute("behat_action_menu::i_open_the_action_menu_in",
array("//tr[contains(.,$gradeitem)]",
"xpath_element"));
}
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, 'gradeitem', 'setup']);
}
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $edit);
// Going to edit calculation.
$savechanges = get_string('savechanges', 'grades');
$edit = behat_context_helper::escape(get_string('editcalculation', 'grades'));
$linkxpath = "//a[./*[contains(concat(' ', normalize-space(@class), ' '), ' icon ') " .
"and starts-with(@title,$edit) and contains(@title,$gradeitem)]]";
$this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element"));
// Mapping names to idnumbers.
$datahash = $data->getRowsHash();
@@ -164,11 +147,11 @@ class behat_grade extends behat_base {
"parent::li[@class='categoryitem' or @class='courseitem']" .
"/parent::ul/parent::li[starts-with(text(),'" . $gradeitem . "')]" .
"]";
$this->execute('behat_forms::i_set_the_field_with_xpath_to', array($inputxpath, $idnumber));
$this->execute('behat_forms::i_set_the_field_with_xpath_to', [$inputxpath, $idnumber]);
}
$this->execute('behat_forms::press_button', get_string('addidnumbers', 'grades'));
$this->execute('behat_forms::i_set_the_field_to', array(get_string('calculation', 'grades'), $calculation));
$this->execute('behat_forms::i_set_the_field_to', [get_string('calculation', 'grades'), $calculation]);
$this->execute('behat_forms::press_button', $savechanges);
}
@@ -182,25 +165,16 @@ class behat_grade extends behat_base {
* @param string $gradeitem The grade item name.
* @param TableNode $data The grade item name - idnumbers relation.
*/
public function i_set_calculation_for_grade_category_with_idnumbers($calculation, $gradeitem, TableNode $data) {
public function i_set_calculation_for_grade_category_with_idnumbers(string $calculation, string $gradeitem, TableNode $data) {
$gradecategorytotal = behat_context_helper::escape($gradeitem . ' total');
$gradeitem = behat_context_helper::escape($gradeitem);
$edit = get_string('editcalculation', 'grades');
if ($this->running_javascript()) {
$xpath = "//tr[contains(.,$gradecategorytotal)]//*[contains(@class,'moodle-actionmenu')]";
if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
$xpath = "//tr[contains(.,$gradecategorytotal)]";
$this->execute("behat_action_menu::i_open_the_action_menu_in", array($xpath, "xpath_element"));
}
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, 'gradeitem', 'setup']);
}
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $edit);
// Going to edit calculation.
$savechanges = get_string('savechanges', 'grades');
$edit = behat_context_helper::escape(get_string('editcalculation', 'grades'));
$linkxpath = "//a[./*[contains(concat(' ', normalize-space(@class), ' '), ' icon ') " .
"and starts-with(@title,$edit) and contains(@title,$gradeitem)]]";
$this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element"));
// Mapping names to idnumbers.
$datahash = $data->getRowsHash();
@@ -218,7 +192,7 @@ class behat_grade extends behat_base {
$this->execute('behat_forms::press_button', get_string('addidnumbers', 'grades'));
$this->execute('behat_forms::i_set_the_field_to', array(get_string('calculation', 'grades'), $calculation));
$this->execute('behat_forms::i_set_the_field_to', [get_string('calculation', 'grades'), $calculation]);
$this->execute('behat_forms::press_button', $savechanges);
}
@@ -228,23 +202,15 @@ class behat_grade extends behat_base {
* Teacher must be on the grade setup page.
*
* @Given /^I reset weights for grade category "(?P<grade_item_string>(?:[^"]|\\")*)"$/
* @param $gradeitem
* @param string $gradeitem
*/
public function i_reset_weights_for_grade_category($gradeitem) {
$steps = array();
public function i_reset_weights_for_grade_category(string $gradeitem) {
if ($this->running_javascript()) {
$gradeitemliteral = behat_context_helper::escape($gradeitem);
$xpath = "//tr[contains(.,$gradeitemliteral)]//*[contains(@class,'moodle-actionmenu')]";
if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
$xpath = "//tr[contains(.,$gradeitemliteral)]";
$this->execute("behat_action_menu::i_open_the_action_menu_in", array($xpath, "xpath_element"));
}
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, 'category', 'setup']);
}
$linktext = get_string('resetweights', 'grades', (object)array('itemname' => $gradeitem));
$this->execute("behat_general::i_click_on", array($this->escape($linktext), "link"));
$linktext = get_string('resetweightsshort', 'grades');
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", [$this->escape($linktext), "link"]);
}
/**
+123
View File
@@ -55,4 +55,127 @@ class behat_grades extends behat_base {
$node = $this->find('xpath', './/input[@value="' . $value . '"]', false, $container);
$node->click();
}
/**
* Gets the grade item id from its name.
*
* @throws Exception
* @param string $itemname Item name
* @return int
*/
protected function get_grade_item_id(string $itemname): int {
global $DB;
if ($id = $DB->get_field('grade_items', 'id', ['itemname' => $itemname])) {
return $id;
}
// The course total is a special case.
if ($itemname === "Course total") {
if (!$id = $DB->get_field('grade_items', 'id', ['itemtype' => 'course'])) {
throw new Exception('The specified grade_item with name "' . $itemname . '" does not exist');
}
return $id;
}
// Find a category with the name.
if ($catid = $DB->get_field('grade_categories', 'id', ['fullname' => $itemname])) {
if ($id = $DB->get_field('grade_items', 'id', ['iteminstance' => $catid])) {
return $id;
}
}
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 "([^"]*)" of type "([^"]*)" on "([^"]*)" page$/
* @param string $itemname Item name
* @param string $itemtype Item type - grade item, category or course
* @param string $page Page - setup or grader
* @throws Exception
*/
public function i_click_on_grade_item_menu(string $itemname, string $itemtype, string $page) {
if ($itemtype == 'gradeitem') {
$itemid = $this->get_grade_item_id($itemname);
} else if ($itemtype == 'category') {
$itemid = $this->get_grade_category_id($itemname);
} else if ($itemtype == 'course') {
$itemid = $this->get_course_grade_category_id($itemname);
} else {
throw new Exception('Unknown item type: ' . $itemtype);
}
$xpath = "//table[@id='grade_edit_tree_table']";
if (($page == 'grader') || ($page == 'setup')) {
if ($page == 'grader') {
$xpath = "//table[@id='user-grades']";
}
if ($itemtype == 'gradeitem') {
$xpath .= "//*[@data-type='item'][@data-id='" . $itemid . "']";
} else if (($itemtype == 'category') || ($itemtype == 'course')) {
$xpath .= "//*[@data-type='category'][@data-id='" . $itemid . "']";
} else {
throw new Exception('Unknown item type: ' . $itemtype);
}
} else {
throw new Exception('Unknown page: ' . $page);
}
$this->execute("behat_general::i_click_on", [$this->escape($xpath), "xpath_element"]);
}
}
+2 -2
View File
@@ -24,7 +24,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
@javascript
Scenario: Hide minimum grade
Given I click on grade item menu "Assignment1"
Given I click on grade item menu "Assignment1" of type "gradeitem" on "grader" page
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
@@ -32,7 +32,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
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 grade item menu "Assignment1"
And I click on grade item menu "Assignment1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I should not see "Minimum grade"
+56 -193
View File
@@ -53,12 +53,9 @@ 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 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 hide the grade item "Test assignment two" of type "gradeitem" on "grader" page
And I hide the grade item "Test assignment five" of type "gradeitem" on "grader" page
And I hide the grade item "Test assignment eight" of type "gradeitem" on "grader" page
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,22 +63,13 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Mean of grades |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Mean of grades |
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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| 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
@@ -94,29 +82,17 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Weighted mean of grades |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Weighted mean of grades |
| Item weight | 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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Weighted mean of grades |
| Item weight | 1 |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| 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
@@ -129,27 +105,15 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Simple weighted mean of grades |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Simple weighted mean of grades |
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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Simple weighted mean of grades |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| 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
@@ -162,27 +126,15 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Mean of grades (with extra credits) |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Mean of grades (with extra credits) |
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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Mean of grades (with extra credits) |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| 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
@@ -195,19 +147,11 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Median of grades |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Median of grades |
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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Median of grades |
| Exclude empty grades | 0 |
And I press "Save changes"
@@ -223,32 +167,17 @@ Feature: We can use calculated grade totals
Scenario: Lowest grade aggregation
When I navigate to "View > Grader report" in the course gradebook
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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Lowest grade |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Lowest grade |
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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Lowest grade |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Test assignment five" of type "gradeitem" on "grader" page:
| Hidden | 1 |
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:
And I set the following settings for grade item "Test assignment four" of type "gradeitem" on "grader" page:
| 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
@@ -261,27 +190,15 @@ Feature: We can use calculated grade totals
Scenario: Highest grade aggregation
When I navigate to "View > Grader report" in the course gradebook
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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Highest grade |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Highest grade |
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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Highest grade |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| 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
@@ -294,27 +211,15 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Mode of grades |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Mode of grades |
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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Mode of grades |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| 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
@@ -338,7 +243,7 @@ Feature: We can use calculated grade totals
| itemname | course | outcome | gradetype | scale |
| Test outcome item one | C1 | OT1 | Scale | Test Scale |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural |
| Include outcomes in aggregation | 1 |
| Exclude empty grades | 0 |
@@ -360,7 +265,7 @@ Feature: We can use calculated grade totals
And I log in as "teacher1"
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":
And I set the following settings for grade item "Test outcome item one" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I log out
And I log in as "student1"
@@ -372,7 +277,7 @@ Feature: We can use calculated grade totals
And I log in as "teacher1"
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 "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural |
| Include outcomes in aggregation | 0 |
And I log out
@@ -395,11 +300,11 @@ Feature: We can use calculated grade totals
| itemname | course | outcome | gradetype | scale |
| Test outcome item one | C1 | OT1 | Scale | Test Scale |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural |
| Include outcomes in aggregation | 1 |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Test outcome item one":
And I set the following settings for grade item "Test outcome item one" of type "gradeitem" on "setup" page:
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
And I change window size to "large"
@@ -419,35 +324,20 @@ Feature: We can use calculated grade totals
Scenario: Natural aggregation
When I navigate to "View > Grader report" in the course gradebook
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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| 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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 1 |
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:
And I set the following settings for grade item "Test assignment six" of type "gradeitem" on "grader" page:
| Weight adjusted | 1 |
| aggregationcoef2 | 50 |
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:
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "grader" page:
| 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
@@ -492,24 +382,15 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| 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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| 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:
@@ -540,21 +421,15 @@ 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 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:
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
| 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 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:
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
| 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"
@@ -564,13 +439,10 @@ 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 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:
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
| 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"
@@ -591,11 +463,11 @@ Feature: We can use calculated grade totals
Scenario: Natural aggregation from the setup screen
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural |
And I set the following settings for grade item "Sub category 1":
And I set the following settings for grade item "Sub category 1" of type "category" on "setup" page:
| Aggregation | Natural |
And I set the following settings for grade item "Sub category 2 &":
And I set the following settings for grade item "Sub category 2 &" of type "category" on "setup" page:
| Aggregation | Natural |
And I set the field "Override weight of Test assignment one &" to "1"
@@ -642,24 +514,15 @@ 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 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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| 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:
And I set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| 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
@@ -37,359 +37,359 @@ 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 click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
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 click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
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 click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
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 click on course grade category menu "Course 1"
Given I click on grade item menu "Course 1" of type "course" on "grader" page
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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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 click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
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 click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
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 click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
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 click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
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 click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b2"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
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.
Given I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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 click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
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 click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
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 click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
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 click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
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 click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
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 click on course grade category menu "Course 1"
Given I click on grade item menu "Course 1" of type "course" on "grader" page
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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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 click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
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 click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
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 click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
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 click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
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 click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
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.
Given I click on course grade category menu "Course 1"
And I click on grade item menu "Course 1" of type "course" on "grader" page
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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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 click on grade category menu "Cat mean"
And I click on grade item menu "Cat mean" of type "category" on "grader" page
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 click on grade category menu "Cat median"
And I click on grade item menu "Cat median" of type "category" on "grader" page
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 click on grade category menu "Cat min"
And I click on grade item menu "Cat min" of type "category" on "grader" page
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 click on grade category menu "Cat natural &"
And I click on grade item menu "Cat natural &" of type "category" on "grader" page
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 click on grade item menu "Item b1"
And I click on grade item menu "Item b1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b2"
And I click on grade item menu "Item b2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b3"
And I click on grade item menu "Item b3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item b4"
And I click on grade item menu "Item b4" of type "gradeitem" on "grader" page
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"
@@ -405,24 +405,24 @@ 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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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"
@@ -435,19 +435,19 @@ 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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
@@ -459,19 +459,19 @@ 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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1"
And I press "Cancel"
@@ -483,22 +483,22 @@ 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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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"
@@ -512,19 +512,19 @@ 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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "11"
And I press "Save changes"
@@ -536,22 +536,22 @@ 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 click on grade item menu "Item a1"
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a2"
And I click on grade item menu "Item a2" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a3"
And I click on grade item menu "Item a3" of type "gradeitem" on "grader" page
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 click on grade item menu "Item a4"
And I click on grade item menu "Item a4" of type "gradeitem" on "grader" page
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"
@@ -35,7 +35,7 @@ Feature: Calculated grade items can be used in the gradebook
And I press "Save changes"
And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat":
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
| Maximum grade | 50 |
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
@@ -62,7 +62,7 @@ Feature: Calculated grade items can be used in the gradebook
And I press "Save changes"
And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat":
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
| Maximum grade | 50 |
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
@@ -76,7 +76,7 @@ Feature: Calculated grade items can be used in the gradebook
| Calc cat totalInclude empty grades. | 100.00 % | 37.50 | 0–50 | 75.00 % | - |
| Course total | - | 37.50 | 0–50 | 75.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Calc cat":
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
| Maximum grade | 40 |
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "65.00" to the user "Student 2" for the grade item "grade item 1"
@@ -124,7 +124,7 @@ Feature: Calculated grade items can be used in the gradebook
And I press "Save changes"
And I set "=[[gi1]]/2" calculation for grade item "calc item" with idnumbers:
| grade item 1 | gi1 |
And I set the following settings for grade item "calc item":
And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page:
| Maximum grade | 50 |
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the following fields to these values:
@@ -142,7 +142,7 @@ Feature: Calculated grade items can be used in the gradebook
| calc item | 33.33 % | 37.50 | 0–50 | 75.00 % | 25.00 % |
| Course total | - | 112.50 | 0–150 | 75.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "calc item":
And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page:
| Rescale existing grades | No |
| Maximum grade | 40 |
And I navigate to "View > Grader report" in the course gradebook
@@ -36,7 +36,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
And I press "Save changes"
And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat":
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
| Maximum grade | 50 |
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
@@ -63,7 +63,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
And I press "Save changes"
And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat":
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
| Maximum grade | 50 |
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
@@ -77,7 +77,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
| Calc cat totalInclude empty grades. | 100.00 % | 37.50 | 0–100 | 37.50 % | - |
| Course total | - | 37.50 | 0–100 | 37.50 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Calc cat":
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
| Maximum grade | 40 |
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "65.00" to the user "Student 2" for the grade item "grade item 1"
@@ -125,7 +125,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
And I press "Save changes"
And I set "=[[gi1]]/2" calculation for grade item "calc item" with idnumbers:
| grade item 1 | gi1 |
And I set the following settings for grade item "calc item":
And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page:
| Maximum grade | 50 |
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the following fields to these values:
@@ -143,7 +143,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
| calc item | 50.00 % | 37.50 | 0–100 | 37.50 % | 18.75 % |
| Course total | - | 112.50 | 0–200 | 56.25 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "calc item":
And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page:
| Rescale existing grades | No |
| Maximum grade | 40 |
And I navigate to "View > Grader report" in the course gradebook
+110 -112
View File
@@ -17,15 +17,13 @@ Feature: We can understand the gradebook user report
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | a1 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment one | Submit something! |
| assign | C1 | a2 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment two | Submit something! |
| assign | C1 | a3 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment three | Submit something! |
| assign | C1 | a4 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment four | Submit something! |
| assign | C1 | a5 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment five | Submit something! |
| assign | C1 | a6 | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Test assignment six | Submit something! |
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
| activity | course | idnumber | name | intro |
| assign | C1 | a1 | Test assignment one | Submit something! |
| assign | C1 | a2 | Test assignment two | Submit something! |
| assign | C1 | a3 | Test assignment three | Submit something! |
| assign | C1 | a4 | Test assignment four | Submit something! |
| assign | C1 | a5 | Test assignment five | Submit something! |
| assign | C1 | a6 | Test assignment six | Submit something! |
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
@@ -34,12 +32,12 @@ Feature: We can understand the gradebook user report
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 give the grade "60.00" to the user "Student 1" for the grade item "EN Test assignment one"
And I give the grade "20.00" to the user "Student 1" for the grade item "EN Test assignment two"
And I give the grade "40.00" to the user "Student 1" for the grade item "EN Test assignment three"
And I give the grade "10.00" to the user "Student 1" for the grade item "EN Test assignment four"
And I give the grade "70.00" to the user "Student 1" for the grade item "EN Test assignment five"
And I give the grade "30.00" to the user "Student 1" for the grade item "EN Test assignment six"
And I give the grade "60.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "20.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "40.00" to the user "Student 1" for the grade item "Test assignment three"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four"
And I give the grade "70.00" to the user "Student 1" for the grade item "Test assignment five"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment six"
And I press "Save changes"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Show weightings" to "Show"
@@ -47,204 +45,204 @@ Feature: We can understand the gradebook user report
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 field "Category name" to "<span lang=\"en\" class=\"multilang\">EN</span><span lang=\"fr\" class=\"multilang\">FR</span> Sub category"
And I set the field "Category name" to "Sub category"
And I press "Save changes"
And I click on "Move" "link" in the "EN Test assignment six" "table_row"
And I click on "Move" "link" in the "Test assignment six" "table_row"
# This xpath finds the forth last row in the table.
And I click on "Move to here" "link" in the "//tbody//tr[position()=last()-3]" "xpath_element"
And I click on "Move" "link" in the "EN Test assignment five" "table_row"
And I click on "Move" "link" in the "Test assignment five" "table_row"
And I click on "Move to here" "link" in the "//tbody//tr[position()=last()-3]" "xpath_element"
And I click on "Move" "link" in the "EN Test assignment four" "table_row"
And I click on "Move" "link" in the "Test assignment four" "table_row"
And I click on "Move to here" "link" in the "//tbody//tr[position()=last()-3]" "xpath_element"
@javascript @skip_chrome_zerosize
Scenario: Mean of grades aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Mean of grades |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 25.00 % | 60.00 | 15.00 % |
| EN Test assignment two | 25.00 % | 20.00 | 5.00 % |
| EN Test assignment three | 25.00 % | 40.00 | 10.00 % |
| EN Test assignment four | 33.33 % | 10.00 | 0.83 % |
| EN Test assignment five | 33.33 % | 70.00 | 5.83 % |
| EN Test assignment six | 33.33 % | 30.00 | 2.50 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 25.00 % | 60.00 | 15.00 % |
| Test assignment two | 25.00 % | 20.00 | 5.00 % |
| Test assignment three | 25.00 % | 40.00 | 10.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.83 % |
| Test assignment five | 33.33 % | 70.00 | 5.83 % |
| Test assignment six | 33.33 % | 30.00 | 2.50 % |
@javascript @skip_chrome_zerosize
Scenario: Weighted mean of grades aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Weighted mean of grades |
And I set the following settings for grade item "EN Test assignment one":
And I set the following settings for grade item "Test assignment one" of type "gradeitem" on "setup" page:
| Item weight | 2.0 |
And I set the following settings for grade item "EN Test assignment two":
And I set the following settings for grade item "Test assignment two" of type "gradeitem" on "setup" page:
| Item weight | 1.0 |
And I set the following settings for grade item "EN Test assignment three":
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Item weight | 1.0 |
And I set the following settings for grade item "EN Sub category":
And I set the following settings for grade item "Sub category" of type "category" on "setup" page:
| Item weight | 1.0 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 40.00 % | 60.00 | 24.00 % |
| EN Test assignment two | 20.00 % | 20.00 | 4.00 % |
| EN Test assignment three | 20.00 % | 40.00 | 8.00 % |
| EN Test assignment four | 33.33 % | 10.00 | 0.67 % |
| EN Test assignment five | 33.33 % | 70.00 | 4.67 % |
| EN Test assignment six | 33.33 % | 30.00 | 2.00 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 40.00 % | 60.00 | 24.00 % |
| Test assignment two | 20.00 % | 20.00 | 4.00 % |
| Test assignment three | 20.00 % | 40.00 | 8.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.67 % |
| Test assignment five | 33.33 % | 70.00 | 4.67 % |
| Test assignment six | 33.33 % | 30.00 | 2.00 % |
@javascript @skip_chrome_zerosize
Scenario: Simple weighted mean of grades aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Simple weighted mean of grades |
And I set the following settings for grade item "EN Sub category":
And I set the following settings for grade item "Sub category" of type "category" on "setup" page:
| Aggregation | Simple weighted mean of grades |
And I set the following settings for grade item "EN Test assignment three":
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 33.33 % | 60.00 | 20.00 % |
| EN Test assignment two | 33.33 % | 20.00 | 6.67 % |
| EN Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| EN Test assignment four | 33.33 % | 10.00 | 1.11 % |
| EN Test assignment five | 33.33 % | 70.00 | 7.78 % |
| EN Test assignment six | 33.33 % | 30.00 | 3.33 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 33.33 % | 60.00 | 20.00 % |
| Test assignment two | 33.33 % | 20.00 | 6.67 % |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| Test assignment four | 33.33 % | 10.00 | 1.11 % |
| Test assignment five | 33.33 % | 70.00 | 7.78 % |
| Test assignment six | 33.33 % | 30.00 | 3.33 % |
@javascript @skip_chrome_zerosize
Scenario: Mean of grades (with extra credits) aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Mean of grades (with extra credits) |
And I set the following settings for grade item "EN Test assignment three":
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Extra credit weight | 1.0 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 33.33 % | 60.00 | 20.00 % |
| EN Test assignment two | 33.33 % | 20.00 | 6.67 % |
| EN Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| EN Test assignment four | 33.33 % | 10.00 | 1.11 % |
| EN Test assignment five | 33.33 % | 70.00 | 7.78 % |
| EN Test assignment six | 33.33 % | 30.00 | 3.33 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 33.33 % | 60.00 | 20.00 % |
| Test assignment two | 33.33 % | 20.00 | 6.67 % |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| Test assignment four | 33.33 % | 10.00 | 1.11 % |
| Test assignment five | 33.33 % | 70.00 | 7.78 % |
| Test assignment six | 33.33 % | 30.00 | 3.33 % |
@javascript @skip_chrome_zerosize
Scenario: Median of grades aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Median of grades |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 0.00 % | 60.00 | 0.00 % |
| EN Test assignment two | 0.00 % | 20.00 | 0.00 % |
| EN Test assignment three | 50.00 % | 40.00 | 20.00 % |
| EN Test assignment four | 33.33 % | 10.00 | 1.67 % |
| EN Test assignment five | 33.33 % | 70.00 | 11.67 % |
| EN Test assignment six | 33.33 % | 30.00 | 5.00 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 0.00 % | 60.00 | 0.00 % |
| Test assignment two | 0.00 % | 20.00 | 0.00 % |
| Test assignment three | 50.00 % | 40.00 | 20.00 % |
| Test assignment four | 33.33 % | 10.00 | 1.67 % |
| Test assignment five | 33.33 % | 70.00 | 11.67 % |
| Test assignment six | 33.33 % | 30.00 | 5.00 % |
@javascript @skip_chrome_zerosize
Scenario: Lowest grade aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Lowest grade |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 0.00 % | 60.00 | 0.00 % |
| EN Test assignment two | 100.00 % | 20.00 | 20.00 % |
| EN Test assignment three | 0.00 % | 40.00 | 0.00 % |
| EN Test assignment four | 33.33 % | 10.00 | 0.00 % |
| EN Test assignment five | 33.33 % | 70.00 | 0.00 % |
| EN Test assignment six | 33.33 % | 30.00 | 0.00 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 0.00 % | 60.00 | 0.00 % |
| Test assignment two | 100.00 % | 20.00 | 20.00 % |
| Test assignment three | 0.00 % | 40.00 | 0.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.00 % |
| Test assignment five | 33.33 % | 70.00 | 0.00 % |
| Test assignment six | 33.33 % | 30.00 | 0.00 % |
@javascript @skip_chrome_zerosize
Scenario: Highest grade aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Highest grade |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 100.00 % | 60.00 | 60.00 % |
| EN Test assignment two | 0.00 % | 20.00 | 0.00 % |
| EN Test assignment three | 0.00 % | 40.00 | 0.00 % |
| EN Test assignment four | 33.33 % | 10.00 | 0.00 % |
| EN Test assignment five | 33.33 % | 70.00 | 0.00 % |
| EN Test assignment six | 33.33 % | 30.00 | 0.00 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 100.00 % | 60.00 | 60.00 % |
| Test assignment two | 0.00 % | 20.00 | 0.00 % |
| Test assignment three | 0.00 % | 40.00 | 0.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.00 % |
| Test assignment five | 33.33 % | 70.00 | 0.00 % |
| Test assignment six | 33.33 % | 30.00 | 0.00 % |
@javascript @skip_chrome_zerosize
Scenario: Mode of grades aggregation
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Mode of grades |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 100.00 % | 60.00 | 60.00 % |
| EN Test assignment two | 0.00 % | 20.00 | 0.00 % |
| EN Test assignment three | 0.00 % | 40.00 | 0.00 % |
| EN Test assignment four | 33.33 % | 10.00 | 0.00 % |
| EN Test assignment five | 33.33 % | 70.00 | 0.00 % |
| EN Test assignment six | 33.33 % | 30.00 | 0.00 % |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 100.00 % | 60.00 | 60.00 % |
| Test assignment two | 0.00 % | 20.00 | 0.00 % |
| Test assignment three | 0.00 % | 40.00 | 0.00 % |
| Test assignment four | 33.33 % | 10.00 | 0.00 % |
| Test assignment five | 33.33 % | 70.00 | 0.00 % |
| Test assignment six | 33.33 % | 30.00 | 0.00 % |
@javascript @skip_chrome_zerosize
Scenario: View user report with mixed aggregation methods
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural |
And I set the following settings for grade item "EN Sub category":
And I set the following settings for grade item "Sub category" of type "category" on "setup" page:
| Aggregation | Weighted mean of grades |
And I set the following settings for grade item "EN Test assignment three":
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 33.33 % | 60.00 | 20.00 % |
| EN Test assignment two | 33.33 % | 20.00 | 6.67 % |
| EN Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| EN Test assignment four | 33.33 % | 10.00 | 1.11 % |
| EN Test assignment five | 33.33 % | 70.00 | 7.78 % |
| EN Test assignment six | 33.33 % | 30.00 | 3.33 % |
| EN Sub category totalWeighted mean of grades. | 33.33 % | 36.67 | - |
| Course total | - | 156.67 | - |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 33.33 % | 60.00 | 20.00 % |
| Test assignment two | 33.33 % | 20.00 | 6.67 % |
| Test assignment three | 33.33 %( Extra credit ) | 40.00 | 13.33 % |
| Test assignment four | 33.33 % | 10.00 | 1.11 % |
| Test assignment five | 33.33 % | 70.00 | 7.78 % |
| Test assignment six | 33.33 % | 30.00 | 3.33 % |
| Sub category totalWeighted mean of grades.| 33.33 % | 36.67 | - |
| Course total | - | 156.67 | - |
@javascript @skip_chrome_zerosize
Scenario: View user report with natural aggregation
And I set the following settings for grade item "EN Test assignment three":
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
# Check the values in the weights column.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| EN Test assignment one | 20.00 % | 60.00 | 12.00 % |
| EN Test assignment two | 20.00 % | 20.00 | 4.00 % |
| EN Test assignment three | 20.00 %( Extra credit ) | 40.00 | 8.00 % |
| EN Test assignment four | 33.33 % | 10.00 | 2.00 % |
| EN Test assignment five | 33.33 % | 70.00 | 14.00 % |
| EN Test assignment six | 33.33 % | 30.00 | 6.00 % |
| EN Sub category total | 60.00 % | 110.00 | - |
| Course total | - | 230.00 | - |
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment one | 20.00 % | 60.00 | 12.00 % |
| Test assignment two | 20.00 % | 20.00 | 4.00 % |
| Test assignment three | 20.00 %( Extra credit ) | 40.00 | 8.00 % |
| Test assignment four | 33.33 % | 10.00 | 2.00 % |
| Test assignment five | 33.33 % | 70.00 | 14.00 % |
| Test assignment six | 33.33 % | 30.00 | 6.00 % |
| Sub category total | 60.00 % | 110.00 | - |
| Course total | - | 230.00 | - |
@@ -17,18 +17,16 @@ Feature: Editing a grade item
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I navigate to "Grades > Scales" in site administration
And I press "Add a new scale"
And I set the following fields to these values:
| Name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> ABCDEF |
| Scale | F,E,D,C,B,A |
| Name | ABCDEF |
| Scale | F,E,D,C,B,A |
And I press "Save changes"
And I press "Add a new scale"
And I set the following fields to these values:
| Name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Letter scale |
| Scale | Disappointing, Good, Very good, Excellent |
| Name | Letter scale |
| Scale | Disappointing, Good, Very good, Excellent |
And I press "Save changes"
And I set the following administration settings values:
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
@@ -38,65 +36,65 @@ Feature: Editing a grade item
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:
| Category name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Cat 1 |
| Aggregation | Highest grade |
| Category name | Cat 1 |
| Aggregation | Highest grade |
And I press "Save changes"
And I press "Add grade item"
And I set the following fields to these values:
| Item name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Item 1 |
| Grade category | EN Cat 1 |
| Item name | Item 1 |
| Grade category | Cat 1 |
And I press "Save changes"
And I press "Add grade item"
And I set the following fields to these values:
| Item name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Item 2 |
| Grade category | EN Cat 1 |
| Item name | Item 2 |
| Grade category | Cat 1 |
And I press "Save changes"
Scenario: Being able to change the grade type, scale and maximum grade for a grade category when there are no overridden grades
When I open the action menu in "EN Cat 1" "table_row"
And I choose "Edit settings" in the open action menu
Given I click on grade item menu "Cat 1" of type "category" on "setup" page
And I choose "Edit category" in the open action menu
Then I should not see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded"
And I expand all fieldsets
And I set the field "Grade type" to "Scale"
And I press "Save changes"
And I should see "Scale must be selected"
And I set the field "Scale" to "EN ABCDEF"
And I set the field "Scale" to "ABCDEF"
And I press "Save changes"
And I should not see "You cannot change the type, as grades already exist for this item"
And I open the action menu in "EN Cat 1" "table_row"
And I choose "Edit settings" in the open action menu
And I click on grade item menu "Cat 1" of type "category" on "setup" page
And I choose "Edit category" in the open action menu
And I should not see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded"
And I expand all fieldsets
And I set the field "Scale" to "EN Letter scale"
And I set the field "Scale" to "Letter scale"
And I press "Save changes"
And I should not see "You cannot change the scale, as grades already exist for this item"
Scenario: Attempting to change a category item's grade type when overridden grades already exist
Given I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "20.00" to the user "Student 1" for the grade item "EN Cat 1 total"
And I give the grade "20.00" to the user "Student 1" for the grade item "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "EN Cat 1" "table_row"
When I choose "Edit settings" in the open action menu
And I click on grade item menu "Cat 1" of type "category" on "setup" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
Then I should see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'Value')]" "xpath_element" should exist
Scenario: Attempting to change a category item's scale when overridden grades already exist
Given I open the action menu in "EN Cat 1" "table_row"
And I choose "Edit settings" in the open action menu
Given I click on grade item menu "Cat 1" of type "category" on "setup" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I set the field "Grade type" to "Scale"
And I set the field "Scale" to "ABCDEF"
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "C" to the user "Student 1" for the grade item "EN Cat 1 total"
And I give the grade "C" to the user "Student 1" for the grade item "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "EN Cat 1" "table_row"
When I choose "Edit settings" in the open action menu
And I click on grade item menu "Cat 1" of type "category" on "setup" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
Then I should see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded, so the grade type and scale cannot be changed."
And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'ABCDEF')]" "xpath_element" should exist
@@ -104,11 +102,11 @@ Feature: Editing a grade item
Scenario: Attempting to change a category item's maximum grade when no rescaling option has been chosen
Given I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "20.00" to the user "Student 1" for the grade item "EN Cat 1 total"
And I give the grade "20.00" to the user "Student 1" for the grade item "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "EN Cat 1" "table_row"
When I choose "Edit settings" in the open action menu
And I click on grade item menu "Cat 1" of type "category" on "setup" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
Then I should see "This category has associated grade items which have been overridden. Therefore some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
And I should see "Choose" in the "Rescale overridden grades" "field"
@@ -120,11 +118,11 @@ Feature: Editing a grade item
| core_langconfig | decsep | # |
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "20#00" to the user "Student 1" for the grade item "EN Cat 1 total"
And I give the grade "20#00" to the user "Student 1" for the grade item "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "EN Cat 1" "table_row"
And I choose "Edit settings" in the open action menu
And I click on grade item menu "Cat 1" of type "category" on "setup" page
And I choose "Edit category" in the open action menu
And I expand all fieldsets
And I set the field "Rescale overridden grades" to "Yes"
And I set the field "Maximum grade" to "87#50"
@@ -55,13 +55,13 @@ Feature: Extra credit contributions are normalised when going out of bounds
Scenario Outline: The contribution of extra credit items is normalised
Given I navigate to "Setup > Gradebook setup" in the course gradebook
When I set the following settings for grade item "Course 1":
When I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | <aggregation> |
And I set the following settings for grade item "Manual item 2":
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Manual item 3":
And I set the following settings for grade item "Manual item 3" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Manual item 4":
And I set the following settings for grade item "Manual item 4" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
@@ -41,12 +41,9 @@ Feature: We can change the maximum and minimum number of points for manual items
And I give the grade "8.00" to the user "Student 2" for the grade item "Manual item 1"
And I press "Save changes"
When I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "Manual item 1" "table_row"
And I choose "Edit settings" in the open action menu
And I set the following fields to these values:
And I set the following settings for grade item "Manual item 1" of type "gradeitem" on "setup" page:
| Rescale existing grades | No |
| Maximum grade | 10 |
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:
@@ -57,8 +54,8 @@ Feature: We can change the maximum and minimum number of points for manual items
| Grade item | Calculated weight | Grade | Contribution to course total |
| Manual item 1 | 100.00 % | 8.00 | 80.00 % |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "Manual item 1" "table_row"
And I choose "Edit settings" in the open action menu
And I click on grade item menu "Manual item 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I set the following fields to these values:
| Rescale existing grades | Yes |
| Maximum grade | 20 |
+10 -15
View File
@@ -17,18 +17,16 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
| teacher1 | C1 | editingteacher |
| student1 | 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 2 | C1 |
| fullname | course |
| Sub category 1 | C1 |
| Sub category 2 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory| grade |
| 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 | 100 |
| assign | C1 | a2 | Test assignment two | Submit something! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 | 100 |
| assign | C1 | a3 | Test assignment three | Submit something! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 2 | 100 |
| assign | C1 | a4 | Test assignment four | Submit something! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 2 | 100 |
| activity | course | idnumber | name | intro | gradecategory | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 | 100 |
| assign | C1 | a2 | Test assignment two | Submit something! | Sub category 1 | 100 |
| assign | C1 | a3 | Test assignment three | Submit something! | Sub category 2 | 100 |
| assign | C1 | a4 | Test assignment four | Submit something! | Sub category 2 | 100 |
And I log in as "admin"
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I press "Add grade item"
@@ -36,7 +34,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
| Item name | calculated |
And I press "Save changes"
And I set "=[[a4]]/2" calculation for grade item "calculated" with idnumbers:
| EN Sub category 1 | sub1 |
| Sub category 1 | sub1 |
And I navigate to "Grades > Report settings > Overview report" in site administration
And I set the field "s__grade_report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I navigate to "Grades > Report settings > User report" in site administration
@@ -50,11 +48,8 @@ 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 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:
And I set the following settings for grade item "Test assignment four" of type "gradeitem" on "grader" page:
| Hidden | 1 |
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
@@ -38,9 +38,8 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
And I give the grade "50.00" to the user "Student 1" for the grade item "Hidden item"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Test locked category":
And I set the following settings for grade item "Test locked category" of type "category" on "setup" page:
| Locked | 1 |
And I press "Save changes"
And I log out
Scenario: Hidden grade items in locked category is hidden for teacher
@@ -32,8 +32,8 @@ Feature: We can duplicate grade items that already exist.
And I should not see "Duplicate Assignment1"
When I duplicate the grade item "Item1"
Then I should see "Item1 (copy)"
And I open the action menu in "Item1 (copy)" "table_row"
And I choose "Edit settings" in the open action menu
And I click on grade item menu "Item1 (copy)" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And the field "Item name" matches value "Item1 (copy)"
And the field "ID number" matches value ""
And the field "Grade type" matches value "Value"
@@ -38,8 +38,7 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
@javascript
Scenario: Hiding the activity using the drop-down hide link and then unhiding the activity using the edit settings form page
Given I click on "Actions" "link" in the "Test assignment name" "table_row"
And I click on "Hide" "link" in the "Test assignment name" "table_row"
Given I hide the grade item "Test assignment name" of type "gradeitem" on "setup" page
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
@@ -48,8 +47,8 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Actions" "link" in the "Test assignment name" "table_row"
And I click on "Edit settings" "link" in the "Test assignment name" "table_row"
And I click on grade item menu "Test assignment name" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And the field "Hidden" matches value "1"
And I set the field "Hidden" to "0"
And I press "Save changes"
@@ -60,8 +59,8 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
@javascript
Scenario: Hiding the activity using the edit settings form page and then unhiding the activity using the drop-down show link
Given I click on "Actions" "link" in the "Test assignment name" "table_row"
And I click on "Edit settings" "link" in the "Test assignment name" "table_row"
Given I click on grade item menu "Test assignment name" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I set the field "Hidden" to "1"
And I press "Save changes"
And I log out
@@ -72,8 +71,8 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Actions" "link" in the "Test assignment name" "table_row"
And I click on "Show" "link" in the "Test assignment name" "table_row"
And I click on grade item menu "Test assignment name" of type "gradeitem" on "setup" page
And I choose "Show" in the open action menu
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
@@ -81,8 +80,7 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
@javascript
Scenario: Hiding the category using the drop-down hide link and then unhiding the category using the edit settings form page
Given I click on "Actions" "link" in the "Course 1" "table_row"
And I click on "Hide" "link" in the "Course 1" "table_row"
Given I hide the grade item "Course 1" of type "course" on "setup" page
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
@@ -91,8 +89,8 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Actions" "link" in the "Course 1" "table_row"
And I click on "Edit settings" "link" in the "Course 1" "table_row"
And I click on grade item menu "Course 1" of type "course" on "setup" page
And I choose "Edit category" in the open action menu
And the field "Hidden" matches value "1"
And I set the field "Hidden" to "0"
And I press "Save changes"
@@ -103,10 +101,8 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
@javascript
Scenario: Hiding the category using the edit settings form page and then unhiding the category using the drop-down show link
Given I click on "Actions" "link" in the "Course 1" "table_row"
And I click on "Edit settings" "link" in the "Course 1" "table_row"
And I set the field "Hidden" to "1"
And I press "Save changes"
Given I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Hidden | 1 |
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
@@ -115,8 +111,8 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Actions" "link" in the "Course 1" "table_row"
And I click on "Show" "link" in the "Course 1" "table_row"
And I click on grade item menu "Course 1" of type "course" on "setup" page
And I choose "Show" in the open action menu
And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
+23 -25
View File
@@ -17,78 +17,76 @@ Feature: Grade item validation
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I navigate to "Grades > Scales" in site administration
And I press "Add a new scale"
And I set the following fields to these values:
| Name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> ABCDEF |
| Scale | F,E,D,C,B,A |
| Name | ABCDEF |
| Scale | F,E,D,C,B,A |
And I press "Save changes"
And I press "Add a new scale"
And I set the following fields to these values:
| Name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Letter scale |
| Scale | Disappointing, Good, Very good, Excellent |
| Name | Letter scale |
| Scale | Disappointing, Good, Very good, Excellent |
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I press "Add grade item"
And I set the following fields to these values:
| Item name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> MI 1 |
| Item name | MI 1 |
And I press "Save changes"
Scenario: Being able to change the grade type, scale and maximum grade for a manual grade item when there are no grades
Given I open the action menu in "EN MI 1" "table_row"
And I choose "Edit settings" in the open action menu
Given I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
When I should not see "Some grades have already been awarded, so the grade type"
Then I set the field "Grade type" to "Scale"
And I press "Save changes"
And I should see "Scale must be selected"
And I set the field "Scale" to "EN ABCDEF"
And I set the field "Scale" to "ABCDEF"
And I press "Save changes"
And I should not see "You cannot change the type, as grades already exist for this item"
And I open the action menu in "EN MI 1" "table_row"
And I choose "Edit settings" in the open action menu
And I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I should not see "Some grades have already been awarded, so the grade type"
And I set the field "Scale" to "EN Letter scale"
And I set the field "Scale" to "Letter scale"
And I press "Save changes"
And I should not see "You cannot change the scale, as grades already exist for this item"
Scenario: Attempting to change a manual item's grade type when grades already exist
Given I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "20.00" to the user "Student 1" for the grade item "EN MI 1"
And I give the grade "20.00" to the user "Student 1" for the grade item "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "EN MI 1" "table_row"
When I choose "Edit settings" in the open action menu
And I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'Value')]" "xpath_element" should exist
Scenario: Attempting to change a manual item's scale when grades already exist
Given I open the action menu in "EN MI 1" "table_row"
And I choose "Edit settings" in the open action menu
Given I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I set the field "Grade type" to "Scale"
And I set the field "Scale" to "EN ABCDEF"
And I set the field "Scale" to "ABCDEF"
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "C" to the user "Student 1" for the grade item "EN MI 1"
And I give the grade "C" to the user "Student 1" for the grade item "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "EN MI 1" "table_row"
When I choose "Edit settings" in the open action menu
And I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
Then I should see "Some grades have already been awarded, so the grade type and scale cannot be changed."
And "//div[contains(concat(' ', normalize-space(@class), ' '), 'felement') and contains(text(), 'ABCDEF')]" "xpath_element" should exist
Scenario: Attempting to change a manual item's maximum grade when no rescaling option has been chosen
Given I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "20.00" to the user "Student 1" for the grade item "EN MI 1"
And I give the grade "20.00" to the user "Student 1" for the grade item "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I open the action menu in "EN MI 1" "table_row"
When I choose "Edit settings" in the open action menu
And I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
Then I should see "Some grades have already been awarded, so the grade type cannot be changed. If you wish to change the maximum grade, you must first choose whether or not to rescale existing grades."
And I should see "Choose" in the "Rescale existing grades" "field"
And the "Maximum grade" "field" should be disabled
+3 -3
View File
@@ -72,13 +72,13 @@ Feature: We can use a minimum grade different than zero
@javascript
Scenario: Natural aggregation with negative and positive grade
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Sub category 1":
And I set the following settings for grade item "Sub category 1" of type "category" on "setup" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Sub category 2":
And I set the following settings for grade item "Sub category 2" of type "category" on "setup" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
And I log out
+4 -4
View File
@@ -61,7 +61,7 @@ Feature: We can choose what min or max grade to use when aggregating grades.
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "CAT1":
And I set the following settings for grade item "CAT1" of type "category" on "setup" page:
| Aggregation | Natural |
And I log out
And I log in as "teacher1"
@@ -97,11 +97,11 @@ Feature: We can choose what min or max grade to use when aggregating grades.
| CAT1 total | 33.33 % | 10.00 | 0–100 | 10.00 % | - |
| Course total | - | 60.00 | 0–300 | 20.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "MI 1":
And I set the following settings for grade item "MI 1" of type "gradeitem" on "setup" page:
| Rescale existing grades | No |
| Maximum grade | 50.00 |
| Minimum grade | 5.00 |
And I set the following settings for grade item "MI 3":
And I set the following settings for grade item "MI 3" of type "gradeitem" on "setup" page:
| Rescale existing grades | No |
| Maximum grade | 50.00 |
| Minimum grade | 5.00 |
@@ -127,7 +127,7 @@ Feature: We can choose what min or max grade to use when aggregating grades.
| CAT1 total | 25.00 % | 10.00 | 0–50 | 20.00 % | - |
| Course total | - | 60.00 | 0–200 | 30.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "MI 5":
And I set the following settings for grade item "MI 5" of type "gradeitem" on "setup" page:
| Rescale existing grades | No |
| Maximum grade | 200.00 |
And I navigate to "View > User report" in the course gradebook
@@ -26,9 +26,9 @@ Feature: Weights in natural aggregation are adjusted if the items are excluded f
And I log in as "teacher1"
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 assignment four (extra)":
And I set the following settings for grade item "Test assignment four (extra)" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment five (extra)":
And I set the following settings for grade item "Test assignment five (extra)" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
@javascript
@@ -95,11 +95,11 @@ Feature: Weights in natural aggregation are adjusted if the items are excluded f
@javascript
Scenario: Make sure there are no errors when all items are marked as extra credit
And I set the following settings for grade item "Test assignment one":
And I set the following settings for grade item "Test assignment one" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment two":
And I set the following settings for grade item "Test assignment two" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment three":
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
@@ -27,9 +27,9 @@ Feature: Gradebook calculations for extra credit items before the fix 20150619
And I log in as "teacher1"
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 assignment four (extra)":
And I set the following settings for grade item "Test assignment four (extra)" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment five (extra)":
And I set the following settings for grade item "Test assignment five (extra)" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
@javascript
@@ -96,11 +96,11 @@ Feature: Gradebook calculations for extra credit items before the fix 20150619
@javascript
Scenario: Make sure there are no errors when all items are marked as extra credit (before the fix 20150619)
And I set the following settings for grade item "Test assignment one":
And I set the following settings for grade item "Test assignment one" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment two":
And I set the following settings for grade item "Test assignment two" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the following settings for grade item "Test assignment three":
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
@@ -18,7 +18,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
| student1 | 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 |
| Sub category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 300 |
@@ -27,11 +27,9 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
| assign | C1 | a4 | Test assignment four | Submit nothing! | 150 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory | grade |
| assign | C1 | a5 | Test assignment five | Submit something! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 | 20 |
| assign | C1 | a6 | Test assignment six | Submit something! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 | 10 |
| assign | C1 | a7 | Test assignment seven | Submit nothing! | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Sub category 1 | 15 |
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
| assign | C1 | a5 | Test assignment five | Submit something! | Sub category 1 | 20 |
| assign | C1 | a6 | Test assignment six | Submit something! | Sub category 1 | 10 |
| assign | C1 | a7 | Test assignment seven | Submit nothing! | Sub category 1 | 15 |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
@@ -100,7 +98,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
@javascript
Scenario: Grade items weights are not normalised when all grade item weights are overridden (sum exactly 100). Extra credit is set respectful to number of items.
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
@@ -115,7 +113,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
And the field "Weight of Test assignment five" matches value "60.000"
And the field "Weight of Test assignment six" matches value "40.000"
And the field "Weight of Test assignment seven" matches value "50.0"
And I reset weights for grade category "EN Sub category 1"
And I reset weights for grade category "Sub category 1"
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
And the field "Weight of Test assignment seven" matches value "50.0"
@@ -123,7 +121,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
@javascript
Scenario: Grade items weights are normalised when all grade item weights are overridden (sum over 100). Extra credit is set respectful to number of items.
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment five" to "1"
And I set the field "Override weight of Test assignment six" to "1"
@@ -135,7 +133,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
And the field "Weight of Test assignment five" matches value "54.545"
And the field "Weight of Test assignment six" matches value "45.455"
And the field "Weight of Test assignment seven" matches value "50.0"
And I reset weights for grade category "EN Sub category 1"
And I reset weights for grade category "Sub category 1"
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
And the field "Weight of Test assignment seven" matches value "50.0"
@@ -143,7 +141,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
@javascript
Scenario: Grade items weights are normalised when all grade item weights are overridden (sum under 100). Extra credit is set respectful to number of items.
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment five" to "1"
And I set the field "Override weight of Test assignment six" to "1"
@@ -155,7 +153,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
And the field "Weight of Test assignment five" matches value "57.143"
And the field "Weight of Test assignment six" matches value "42.857"
And the field "Weight of Test assignment seven" matches value "50.0"
And I reset weights for grade category "EN Sub category 1"
And I reset weights for grade category "Sub category 1"
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
And the field "Weight of Test assignment seven" matches value "50.0"
@@ -163,7 +161,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
@javascript
Scenario: Grade items weights are normalised when not all grade item weights are overridden. Extra credit is set respectful to number of items.
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment five" to "1"
And I set the field "Weight of Test assignment five" to "40"
@@ -173,7 +171,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
And the field "Weight of Test assignment five" matches value "40.00"
And the field "Weight of Test assignment six" matches value "60.000"
And the field "Weight of Test assignment seven" matches value "50.0"
And I reset weights for grade category "EN Sub category 1"
And I reset weights for grade category "Sub category 1"
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
And the field "Weight of Test assignment seven" matches value "50.0"
@@ -182,7 +180,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
Scenario: The extra credit grade item weight is overridden to a figure over one hundred and then
the grade item is set to normal.
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment seven" to "1"
And I set the field "Weight of Test assignment seven" to "105"
@@ -191,7 +189,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
And the field "Weight of Test assignment seven" matches value "105.0"
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 0 |
And I should see "Your weights have been adjusted to total 100."
@@ -203,13 +201,13 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
Scenario: The extra credit grade item weight is overridden to a figure over one hundred and then
the grade category is reset.
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment seven" to "1"
And I set the field "Weight of Test assignment seven" to "105"
And I press "Save changes"
And I reset weights for grade category "EN Sub category 1"
And I reset weights for grade category "Sub category 1"
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
And the field "Weight of Test assignment seven" matches value "50.0"
@@ -231,14 +229,14 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
@javascript
Scenario: With one grade item set as extra credit, when I reset the weights for a category they return to the natural weights.
When I set the following settings for grade item "Test assignment five":
When I set the following settings for grade item "Test assignment five" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment six" to "1"
And I set the field "Override weight of Test assignment seven" to "1"
And I set the field "Weight of Test assignment six" to "55"
And I set the field "Weight of Test assignment seven" to "40"
And I press "Save changes"
And I reset weights for grade category "EN Sub category 1"
And I reset weights for grade category "Sub category 1"
Then the field "Weight of Test assignment five" matches value "80.0"
And the field "Weight of Test assignment six" matches value "40.0"
And the field "Weight of Test assignment seven" matches value "60.0"
@@ -256,7 +254,7 @@ Feature: We can use natural aggregation and weights will be normalised to a tota
And I press "Save changes"
And the field "Weight of Test assignment six" matches value "0.0"
And the field "Weight of Test assignment seven" matches value "100.0"
And I reset weights for grade category "EN Sub category 1"
And I reset weights for grade category "Sub category 1"
And I set the field "Override weight of Test assignment five" to "1"
And I set the field "Override weight of Test assignment six" to "1"
And I set the field "Weight of Test assignment five" to "-10"
@@ -37,7 +37,7 @@ Feature: Gradebook calculations for natural weights normalisation before the fix
@javascript
Scenario: Grade items weights are normalised when all grade item weights are overridden (sum exactly 100). Extra credit is set to zero (before the fix 20150619).
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And the field "Weight of Test assignment five" matches value "66.667"
And the field "Weight of Test assignment six" matches value "33.333"
@@ -60,7 +60,7 @@ Feature: Gradebook calculations for natural weights normalisation before the fix
@javascript
Scenario: Grade items weights are normalised when all grade item weights are overridden (sum over 100). Extra credit is set to zero (before the fix 20150619).
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment five" to "1"
And I set the field "Override weight of Test assignment six" to "1"
@@ -80,7 +80,7 @@ Feature: Gradebook calculations for natural weights normalisation before the fix
@javascript
Scenario: Grade items weights are normalised when all grade item weights are overridden (sum under 100). Extra credit is set to zero (before the fix 20150619).
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment five" to "1"
And I set the field "Override weight of Test assignment six" to "1"
@@ -100,7 +100,7 @@ Feature: Gradebook calculations for natural weights normalisation before the fix
@javascript
Scenario: Grade items weights are normalised when not all grade item weights are overridden. Extra credit is set respectful to non-overridden items (before the fix 20150619).
When I set the following settings for grade item "Test assignment seven":
When I set the following settings for grade item "Test assignment seven" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
And I set the field "Override weight of Test assignment five" to "1"
And I set the field "Weight of Test assignment five" to "40"
@@ -42,11 +42,10 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on "Actions" "link" in the ".coursecategory" "css_element"
And I click on "Edit settings" "link" in the ".coursecategory" "css_element"
And I set the field "Aggregation" to "Weighted mean of grades"
And I set the field "Rescale overridden grades" to "Yes"
And I set the field "Maximum grade" to "200"
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Weighted mean of grades |
| Rescale overridden grades | Yes |
| Maximum grade | 200 |
And I press "Save changes"
@javascript
+7 -15
View File
@@ -6,16 +6,14 @@ Feature: View gradebook when scales are used
Background:
Given I log in as "admin"
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I set the following administration settings values:
| grade_report_showranges | 1 |
| grade_aggregations_visible | Mean of grades,Weighted mean of grades,Simple weighted mean of grades,Mean of grades (with extra credits),Median of grades,Lowest grade,Highest grade,Mode of grades,Natural |
And I navigate to "Grades > Scales" in site administration
And I press "Add a new scale"
And I set the following fields to these values:
| Name | <span lang="en" class="multilang">EN</span><span lang="fr" class="multilang">FR</span> Letterscale |
| Scale | F,D,C,B,A |
| Name | Letterscale |
| Scale | F,D,C,B,A |
And I press "Save changes"
And I log out
And the following "courses" exist:
@@ -46,7 +44,7 @@ Feature: View gradebook when scales are used
And I am on the "Test assignment one" "assign activity editing" page logged in as teacher1
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Scale"
And I set the field "grade[modgrade_scale]" to "EN Letterscale"
And I set the field "grade[modgrade_scale]" to "Letterscale"
And I press "Save and display"
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
@@ -109,19 +107,13 @@ Feature: View gradebook when scales are used
| Course total | 4.00 | 0–5 | 80.00 % | - |
Scenario Outline: Test displaying scales in gradebook in all other aggregation methods
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:
Given I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | <aggregation> |
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:
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| 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- | -1- | -3- | -4- | -5- |
@@ -145,8 +137,8 @@ Feature: View gradebook when scales are used
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | A (5) |
| Sub category (<aggregation>) total<aggregation>. | |
| Course total<aggregation>. | |
| Sub category (<aggregation>) total | |
| Course total | |
And I log out
And I log in as "student2"
And I follow "Grades" in the user menu
@@ -44,11 +44,8 @@ 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"
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:
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| 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:
@@ -88,16 +85,14 @@ 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 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:
When I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| 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"
And I open the action menu in "Scale me" "table_row"
And I click on "Edit settings" "link" in the "Scale me" "table_row"
And I click on grade item menu "Scale me" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I follow "Show more..."
And I should not see "Weight adjusted"
And I should not see "Weight"
@@ -109,8 +104,8 @@ Feature: Control the aggregation of the scales
And the field "Override weight of Grade me" matches value "95.238"
And I set the field "Override weight of Scale me" to "1"
And the field "Override weight of Scale me" matches value "4.8"
And I open the action menu in "Scale me" "table_row"
And I click on "Edit settings" "link" in the "Scale me" "table_row"
And I click on grade item menu "Scale me" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I follow "Show more..."
And I should see "Weight adjusted"
And I should see "Weight"
@@ -86,17 +86,11 @@ Feature: View gradebook when single item scales are used
| Course total | 1.00 |
Scenario Outline: Test displaying single item scales in gradebook in all other aggregation methods
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:
Given I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | <aggregation> |
And I press "Save changes"
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:
And I set the following settings for grade item "<span lang='en' class='multilang'>EN</span><span lang='fr' class='multilang'>FR</span> Sub category 1" of type "category" on "grader" page:
| 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- | -1- | -3- | -4- | -5- |
@@ -117,8 +111,8 @@ Feature: View gradebook when single item scales are used
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | Ace! (1) |
| Sub category (<aggregation>) total<aggregation>. | 100.00 |
| Course total<aggregation>. | 100.00 |
| Sub category (<aggregation>) total | 100.00 |
| Course total | 100.00 |
Examples:
| aggregation | contrib1 | cattotal1 | coursetotal1 | catavg | overallavg |
+11 -11
View File
@@ -62,7 +62,7 @@ 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 grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
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
@@ -72,7 +72,7 @@ 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 grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And the field "Grade to pass" matches value "30"
@@ -86,7 +86,7 @@ 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 grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
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"
@@ -121,13 +121,13 @@ 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 grade item menu "Test Workshop 1 (submission)"
And I click on grade item menu "Test Workshop 1 (submission)" of type "gradeitem" on "grader" page
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 grade item menu "Test Workshop 1 (assessment)"
And I click on grade item menu "Test Workshop 1 (assessment)" of type "gradeitem" on "grader" page
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"
@@ -163,7 +163,7 @@ 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 grade item menu "Test Quiz 1"
And I click on grade item menu "Test Quiz 1" of type "gradeitem" on "grader" page
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"
@@ -184,7 +184,7 @@ 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 grade item menu "Test Lesson 1"
And I click on grade item menu "Test Lesson 1" of type "gradeitem" on "grader" page
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"
@@ -206,7 +206,7 @@ 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 grade item menu "Test Lesson 1"
And I click on grade item menu "Test Lesson 1" of type "gradeitem" on "grader" page
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"
@@ -229,7 +229,7 @@ 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 grade item menu "Test Database 1"
And I click on grade item menu "Test Database 1" of type "gradeitem" on "grader" page
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"
@@ -270,7 +270,7 @@ 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 grade item menu "Test Forum 1 rating"
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page
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"
@@ -294,7 +294,7 @@ 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 grade item menu "Test Glossary 1"
And I click on grade item menu "Test Glossary 1" of type "gradeitem" on "grader" page
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"
+1 -1
View File
@@ -90,7 +90,7 @@ Feature: We can enter in grades and view reports from the gradebook
Scenario: We can add a weighting to a grade item and it is displayed properly in the user report
When I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Course 1":
And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Weighted mean of grades |
And I set the field "Extra credit value for Test assignment name" to "0.72"
And I press "Save changes"
+2 -2
View File
@@ -27,10 +27,10 @@ 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 I click on grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
And "Edit grade item" "link" should exist
And I turn editing mode off
And I click on grade item menu "Test Assignment 1"
And I click on grade item menu "Test Assignment 1" of type "gradeitem" on "grader" page
Then "Edit grade item" "link" should not exist
Scenario: Edit mode on page Homepage
+4 -4
View File
@@ -66,7 +66,7 @@ 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.
And I click on grade item menu "Test Forum 1 whole forum"
And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
@@ -122,7 +122,7 @@ 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.
And I click on grade item menu "Test Forum 1 rating"
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
@@ -159,7 +159,7 @@ 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.
And I click on grade item menu "Test Forum 1 rating"
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "100"
@@ -167,7 +167,7 @@ Feature: I can grade a students interaction across a forum
And I should see "Peers" in the "Parent category" "fieldset"
And I press "cancel"
And I click on grade item menu "Test Forum 1 whole forum"
And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
When I expand all fieldsets
Then the field "Maximum grade" matches value "10"
+9
View File
@@ -372,6 +372,7 @@
.weightoverride {
margin-right: 5px;
}
min-width: 10em;
}
&.column-actions {
@@ -481,6 +482,14 @@
}
}
}
.badge-light {
color: #1d2125;
background-color: #ced4da;
margin-right: 0.5em;
margin-bottom: 0.5em;
}
}
}
+9
View File
@@ -34867,6 +34867,9 @@ p.arrow_button {
width: 18px;
height: 18px;
}
.path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr td.column-weight {
min-width: 10em;
}
.path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr td.column-weight .weightoverride {
margin-right: 5px;
}
@@ -34942,6 +34945,12 @@ p.arrow_button {
.path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr.item.categoryitem td:not(.column-actions), .path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr.item.courseitem td:not(.column-actions) {
font-weight: bold;
}
.path-grade-edit-tree .gradetree-wrapper .badge-light {
color: #1d2125;
background-color: #ced4da;
margin-right: 0.5em;
margin-bottom: 0.5em;
}
/**
* Grader report.
+9
View File
@@ -34867,6 +34867,9 @@ p.arrow_button {
width: 18px;
height: 18px;
}
.path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr td.column-weight {
min-width: 10em;
}
.path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr td.column-weight .weightoverride {
margin-right: 5px;
}
@@ -34942,6 +34945,12 @@ p.arrow_button {
.path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr.item.categoryitem td:not(.column-actions), .path-grade-edit-tree .gradetree-wrapper .setup-grades.generaltable tr.item.courseitem td:not(.column-actions) {
font-weight: bold;
}
.path-grade-edit-tree .gradetree-wrapper .badge-light {
color: #1d2125;
background-color: #ced4da;
margin-right: 0.5em;
margin-bottom: 0.5em;
}
/**
* Grader report.