first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+482
View File
@@ -0,0 +1,482 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Behat grade related steps definitions.
*
* @package core_grades
* @category test
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
use Behat\Gherkin\Node\TableNode as TableNode;
class behat_grade extends behat_base {
/**
* Enters a grade via the gradebook for a specific grade item and user when viewing the 'Grader report' with editing mode turned on.
*
* @Given /^I give the grade "(?P<grade_number>(?:[^"]|\\")*)" to the user "(?P<username_string>(?:[^"]|\\")*)" for the grade item "(?P<grade_activity_string>(?:[^"]|\\")*)"$/
* @param int $grade
* @param string $userfullname the user's fullname as returned by fullname()
* @param string $itemname
*/
public function i_give_the_grade($grade, $userfullname, $itemname) {
$this->execute('behat_navigation::i_close_block_drawer_if_open');
$gradelabel = $userfullname . ' ' . $itemname;
$fieldstr = get_string('useractivitygrade', 'gradereport_grader', $gradelabel);
$this->execute('behat_forms::i_set_the_field_to', array($this->escape($fieldstr), $grade));
}
/**
* Changes the settings of a grade item or category or the course.
*
* 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>(?:[^"]|\\")*)" 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(string $gradeitem, string $type, string $page, TableNode $data) {
$this->execute("behat_navigation::i_close_block_drawer_if_open");
if ($this->running_javascript()) {
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, $type, $page]);
}
$linktext = $type == 'gradeitem' ? get_string('itemsedit', 'grades') : get_string('categoryedit', 'grades');
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $linktext);
if ($type !== 'gradeitem') {
$this->execute('behat_general::i_click_on_in_the', [get_string('showmore', 'form'),
'link', '.modal-dialog', 'css_element']);
}
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data);
if ($this->getSession()->getPage()->find('xpath', './/button[@data-action="save"]')) {
$container = $this->get_selected_node("core_grades > gradeitem modal", "form");
$this->execute('behat_general::i_click_on_in_the', [
'.//button[@data-action="save"]',
'xpath',
$container,
'NodeElement',
]);
} else {
$savechanges = get_string('savechanges', 'grades');
$this->execute('behat_forms::press_button', $this->escape($savechanges));
}
}
/**
* 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>(?:[^"]|\\")*)" of type "([^"]*)" on "([^"]*)" page$/
* @param string $gradeitem
* @param string $type
* @param string $page
*/
public function i_hide_the_grade_item(string $gradeitem, string $type, string $page) {
$linktext = get_string('hide');
if ($this->running_javascript()) {
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, $type, $page]);
}
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $linktext);
}
/**
* Duplicates a grade item or category.
*
* Teacher must be on the grade setup page.
*
* @Given /^I duplicate the grade item "(?P<grade_item_string>(?:[^"]|\\")*)"$/
* @param string $gradeitem
*/
public function i_duplicate_the_grade_item(string $gradeitem) {
$linktext = get_string('duplicate');
if ($this->running_javascript()) {
$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", $linktext);
}
/**
* Sets a calculated manual grade item. Needs a table with item name - idnumber relation.
* The step requires you to be in the 'Gradebook setup' page.
*
* @Given /^I set "(?P<calculation_string>(?:[^"]|\\")*)" calculation for grade item "(?P<grade_item_string>(?:[^"]|\\")*)" with idnumbers:$/
* @param string $calculation The calculation.
* @param string $gradeitem The grade item name.
* @param TableNode $TableNode The grade item name - idnumbers relation.
*/
public function i_set_calculation_for_grade_item_with_idnumbers($calculation, $gradeitem, TableNode $data) {
$edit = get_string('editcalculation', 'grades');
if ($this->running_javascript()) {
$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);
$savechanges = get_string('savechanges', 'grades');
// Mapping names to idnumbers.
$datahash = $data->getRowsHash();
foreach ($datahash as $gradeitem => $idnumber) {
// This xpath looks for course, categories and items with the provided name.
// Grrr, we can't equal in categoryitem and courseitem because there is a line jump...
$inputxpath = "//input[@class='idnumber'][" .
"parent::li[@class='item'][text()='" . $gradeitem . "']" .
" or " .
"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', [$inputxpath, $idnumber]);
}
$this->execute('behat_forms::press_button', get_string('addidnumbers', 'grades'));
$this->execute('behat_forms::i_set_the_field_to', [get_string('calculation', 'grades'), $calculation]);
$this->execute('behat_forms::press_button', $savechanges);
}
/**
* Sets a calculated manual grade category total. Needs a table with item name - idnumber relation.
* The step requires you to be in the 'Gradebook setup' page.
*
* @Given /^I set "(?P<calculation_string>(?:[^"]|\\")*)" calculation for grade category "(?P<grade_item_string>(?:[^"]|\\")*)" with idnumbers:$/
* @param string $calculation The calculation.
* @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(string $calculation, string $gradeitem, TableNode $data) {
$edit = get_string('editcalculation', 'grades');
if ($this->running_javascript()) {
$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);
$savechanges = get_string('savechanges', 'grades');
// Mapping names to idnumbers.
$datahash = $data->getRowsHash();
foreach ($datahash as $gradeitem => $idnumber) {
// This xpath looks for course, categories and items with the provided name.
// Grrr, we can't equal in categoryitem and courseitem because there is a line jump...
$inputxpath = "//input[@class='idnumber'][" .
"parent::li[@class='item'][text()='" . $gradeitem . "']" .
" | " .
"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::press_button', get_string('addidnumbers', 'grades'));
$this->execute('behat_forms::i_set_the_field_to', [get_string('calculation', 'grades'), $calculation]);
$this->execute('behat_forms::press_button', $savechanges);
}
/**
* Resets the weights for the grade category
*
* Teacher must be on the grade setup page.
*
* @Given /^I reset weights for grade category "(?P<grade_item_string>(?:[^"]|\\")*)"$/
* @param string $gradeitem
*/
public function i_reset_weights_for_grade_category(string $gradeitem) {
if ($this->running_javascript()) {
$this->execute("behat_grades::i_click_on_grade_item_menu", [$gradeitem, 'category', 'setup']);
}
$linktext = get_string('resetweightsshort', 'grades');
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", [$this->escape($linktext), "link"]);
}
/**
* Step allowing to test before-the-fix behaviour of the gradebook
*
* @Given /^gradebook calculations for the course "(?P<coursename_string>(?:[^"]|\\")*)" are frozen at version "(?P<version_string>(?:[^"]|\\")*)"$/
* @param string $coursename
* @param string $version
*/
public function gradebook_calculations_for_the_course_are_frozen_at_version($coursename, $version) {
global $DB;
$courseid = $DB->get_field('course', 'id', array('shortname' => $coursename), MUST_EXIST);
set_config('gradebook_calculations_freeze_' . $courseid, $version);
}
/**
* Select the tab in the gradebook. We must be on one of the gradebook pages already.
*
* @deprecated since 4.0 - use behat_forms::i_set_the_field_to() instead.
* @param string $gradepath examples: "View > User report", "Letters > View", "Scales"
*/
protected function select_in_gradebook_tabs($gradepath) {
debugging('The function select_in_gradebook_tabs() is deprecated, please use ' .
'behat_forms::i_set_the_field_to() instead.', DEBUG_DEVELOPER);
$gradepath = preg_split('/\s*>\s*/', trim($gradepath));
if (count($gradepath) > 2) {
throw new coding_exception('Grade path is too long (must have no more than two items separated with ">")');
}
$xpath = '//div[contains(@class,\'grade-navigation\')]';
// If the first row of the grade-navigation tabs does not have $gradepath[0] as active tab, click on it.
$link = '\'' . $this->escape($gradepath[0]) . '\'';
$xpathrow1 = $xpath . '//ul[1]//*[contains(@class,\'active\') and contains(normalize-space(.), ' . $link . ')]';
if (!$this->getSession()->getPage()->findAll('xpath', $xpathrow1)) {
$this->find('xpath', $xpath . '//ul[1]/li/a[text()=' . $link . ']')->click();
$this->wait_for_pending_js();
}
if (isset($gradepath[1])) {
// If the second row of the grade-navigation tabs does not have $gradepath[1] as active tab, click on it.
$link = '\'' . $this->escape($gradepath[1]) . '\'';
$xpathrow2 = $xpath . '//ul[2]//*[contains(@class,\'active\') and contains(normalize-space(.), ' . $link . ')]';
if (!$this->getSession()->getPage()->findAll('xpath', $xpathrow2)) {
$this->find('xpath', $xpath . '//ul[2]/li/a[text()=' . $link . ']')->click();
$this->wait_for_pending_js();
}
}
}
/**
* Navigates to the course gradebook and selects the specified item from the general grade navigation selector.
*
* Examples:
* - I navigate to "Setup > Gradebook setup" in the course gradebook
* - I navigate to "Scales" in the course gradebook
* - I navigate to "More > Grade letters" in the course gradebook
*
* @Given /^I navigate to "(?P<gradepath_string>(?:[^"]|\\")*)" in the course gradebook$/
* @param string $gradepath The path string. If the path has two items (ex. "More > Grade letters"), the first item
* ("More") will be used to identify an option group in the navigation selector, while the
* second ("Grade letters") will be used to identify an option within that option group.
* Otherwise, a single item in a path (ex. "Scales") will be used to identify an option in
* the navigation selector regardless of the option group.
*/
public function i_navigate_to_in_the_course_gradebook($gradepath) {
// If we are not on one of the gradebook pages already, follow "Grades" link in the navigation drawer.
$xpath = '//div[contains(@class,\'grade-navigation\')]';
if (!$this->getSession()->getPage()->findAll('xpath', $xpath)) {
$this->execute('behat_navigation::i_select_from_secondary_navigation', get_string('grades'));
}
$this->execute('behat_forms::i_set_the_field_to', [get_string('gradebooknavigationmenu', 'grades'), $gradepath]);
}
/**
* Navigates to the imports page in the course gradebook and selects the specified import type from the grade
* imports navigation selector.
*
* Examples:
* - I navigate to "CSV file" import page in the course gradebook
*
* @Given /^I navigate to "(?P<importoption_string>(?:[^"]|\\")*)" import page in the course gradebook$/
* @param string $gradeimportoption The name of an existing grade import option.
*/
public function i_navigate_to_import_page_in_the_course_gradebook($gradeimportoption) {
$this->i_navigate_to_in_the_course_gradebook("More > Import");
$this->execute('behat_forms::i_set_the_field_to', [get_string('importas', 'grades'), $gradeimportoption]);
}
/**
* Navigates to the exports page in the course gradebook and selects the specified export type from the grade
* exports navigation selector.
*
* Examples:
* - I navigate to "XML file" export page in the course gradebook
*
* @Given /^I navigate to "(?P<exportoption_string>(?:[^"]|\\")*)" export page in the course gradebook$/
* @param string $gradeexportoption The name of an existing grade export option.
*/
public function i_navigate_to_export_page_in_the_course_gradebook($gradeexportoption) {
$this->i_navigate_to_in_the_course_gradebook("More > Export");
$this->execute('behat_forms::i_set_the_field_to', [get_string('exportas', 'grades'), $gradeexportoption]);
}
/**
* Select a given option from a navigation URL selector in the gradebook. We must be on one of the gradebook pages
* already.
*
* @deprecated since 4.1 - use behat_forms::i_set_the_field_to() instead.
* @param string $path The string path that is used to identify an item within the navigation selector. If the path
* has two items (ex. "More > Grade letters"), the first item ("More") will be used to identify
* an option group in the navigation selector, while the second ("Grade letters") will be used to
* identify an option within that option group. Otherwise, a single item in a path (ex. "Scales")
* will be used to identify an option in the navigation selector regardless of the option group.
* @param string $formid The ID of the form element which contains the navigation URL selector element.
*/
protected function select_in_gradebook_navigation_selector(string $path, string $formid) {
debugging('The function select_in_gradebook_navigation_selector() is deprecated, please use ' .
'behat_forms::i_set_the_field_to() instead.', DEBUG_DEVELOPER);
// Split the path string by ">".
$path = preg_split('/\s*>\s*/', trim($path));
// Make sure that the path does not have more than two items separated with ">".
if (count($path) > 2) {
throw new coding_exception('The path is too long (must have no more than two items separated with ">")');
}
// Get the select element.
$selectxpath = "//form[contains(@id,'{$formid}')]//select";
$select = $this->find('xpath', $selectxpath);
// Define the xpath to the option element depending on the provided path.
// If two items are provided in the path, the first item will be considered as an identifier of an existing
// option group in the select select element, while the second item will identify an existing option within
// that option group.
// If one item is provided in the path, this item will identify any existing option in the select element
// regardless of the option group. Also, this is useful when option elements are not a part of an option group
// which is possible.
if (count($path) === 2) {
$optionxpath = $selectxpath . '/optgroup[@label="' . $this->escape($path[0]) . '"]' .
'/option[contains(.,"' . $this->escape($path[1]) . '")]';
} else {
$optionxpath = $selectxpath . '//option[contains(.,"' . $this->escape($path[0]) . '")]';
}
// Get the option element that we are looking to select.
$option = $this->find('xpath', $optionxpath);
// Select the given option in the select element.
$field = behat_field_manager::get_field_instance('select', $select, $this->getSession());
$field->set_value($this->escape($option->getValue()));
if (!$this->running_javascript()) {
$this->execute('behat_general::i_click_on_in_the', [get_string('go'), 'button',
"#{$formid}", 'css_element']);
}
}
/**
* We tend to use this series of steps a bit so define em once.
*
* @param string $haystack What are we searching within?
* @param string $needle What are we looking for?
* @param bool $fieldset Do we want to set the search field at the same time?
* @return string
* @throws coding_exception
*/
private function get_dropdown_selector(string $haystack, string $needle, bool $fieldset = true): string {
$this->execute("behat_general::wait_until_the_page_is_ready");
// Set the default field to search and handle any special preamble.
$string = get_string('searchusers', 'core');
$selector = '.usersearchdropdown';
if (strtolower($haystack) === 'group') {
$string = get_string('searchgroups', 'core');
$selector = '.groupsearchdropdown';
$trigger = ".groupsearchwidget";
$node = $this->find("css_element", $selector);
if (!$node->isVisible()) {
$this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
}
} else if (strtolower($haystack) === 'grade') {
$string = get_string('searchitems', 'core');
$selector = '.gradesearchdropdown';
$trigger = ".gradesearchwidget";
$node = $this->find("css_element", $selector);
if (!$node->isVisible()) {
$this->execute("behat_general::i_click_on", [$trigger, "css_element"]);
}
}
if ($fieldset) {
$this->execute("behat_forms::set_field_value", [$string, $needle]);
$this->execute("behat_general::wait_until_exists", [$needle, "list_item"]);
}
return $selector;
}
/**
* Confirm if a value is within the search widget within the gradebook.
*
* Examples:
* - I confirm "User" in "user" search within the gradebook widget exists
* - I confirm "Group" in "group" search within the gradebook widget exists
* - I confirm "Grade item" in "grade" search within the gradebook widget exists
*
* @Given /^I confirm "(?P<needle>(?:[^"]|\\")*)" in "(?P<haystack>(?:[^"]|\\")*)" search within the gradebook widget exists$/
* @param string $needle The value to search for.
* @param string $haystack The type of the search widget.
*/
public function i_confirm_in_search_within_the_gradebook_widget_exists($needle, $haystack) {
$this->execute("behat_general::assert_element_contains_text",
[$needle, $this->get_dropdown_selector($haystack, $needle, false), "css_element"]);
}
/**
* Confirm if a value is not within the search widget within the gradebook.
*
* Examples:
* - I confirm "User" in "user" search within the gradebook widget does not exist
* - I confirm "Group" in "group" search within the gradebook widget does not exist
* - I confirm "Grade item" in "grade" search within the gradebook widget does not exist
*
* @Given /^I confirm "(?P<needle>(?:[^"]|\\")*)" in "(?P<haystack>(?:[^"]|\\")*)" search within the gradebook widget does not exist$/
* @param string $needle The value to search for.
* @param string $haystack The type of the search widget.
*/
public function i_confirm_in_search_within_the_gradebook_widget_does_not_exist($needle, $haystack) {
$this->execute("behat_general::assert_element_not_contains_text",
[$needle, $this->get_dropdown_selector($haystack, $needle, false), "css_element"]);
}
/**
* Clicks on an option from the specified search widget in the current gradebook page.
*
* Examples:
* - I click on "Student" in the "user" search widget
* - I click on "Group" in the "group" search widget
* - I click on "Grade item" in the "grade" search widget
*
* @Given /^I click on "(?P<needle>(?:[^"]|\\")*)" in the "(?P<haystack>(?:[^"]|\\")*)" search widget$/
* @param string $needle The value to search for.
* @param string $haystack The type of the search widget.
*/
public function i_click_on_in_search_widget(string $needle, string $haystack) {
$selector = $this->get_dropdown_selector($haystack, $needle);
$this->execute('behat_general::i_click_on_in_the', [
$needle, "list_item",
$selector, "css_element"
]);
$this->execute("behat_general::i_wait_to_be_redirected");
}
}
@@ -0,0 +1,56 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
use Behat\Gherkin\Node\TableNode;
require_once(__DIR__ . '/../../../lib/behat/behat_deprecated_base.php');
/**
* Steps definitions that are now deprecated and will be removed in the next releases.
*
* This file only contains the steps that previously were in the behat_*.php files in the SAME DIRECTORY.
* When deprecating steps from other components or plugins, create a behat_COMPONENT_deprecated.php
* file in the same directory where the steps were defined.
*
* @package core_grades
* @category test
* @copyright 2023 Ilya Tregubov
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_grade_deprecated extends behat_deprecated_base {
/**
* Enters a quick feedback via the gradebook for a specific grade item and user when viewing
* the 'Grader report' with editing mode turned on.
*
* @deprecated since 4.2 - we don't allow edit feedback on grader report anymore.
* @todo MDL-77107 This will be deleted in Moodle 4.6.
* @Given /^I give the feedback "(?P<grade_number>(?:[^"]|\\")*)" to the user "(?P<username_string>(?:[^"]|\\")*)" for the grade item "(?P<grade_activity_string>(?:[^"]|\\")*)"$/
* @param string $feedback
* @param string $userfullname the user's fullname as returned by fullname()
* @param string $itemname
*/
public function i_give_the_feedback($feedback, $userfullname, $itemname) {
$this->deprecated_message(['behat_grade::i_give_the_feedback']);
$gradelabel = $userfullname . ' ' . $itemname;
$fieldstr = get_string('useractivityfeedback', 'gradereport_grader', $gradelabel);
$this->execute('behat_forms::i_set_the_field_to', array($this->escape($fieldstr), $this->escape($feedback)));
}
}
+272
View File
@@ -0,0 +1,272 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../lib/behat/behat_base.php');
/**
* Behat grade related steps definitions.
*
* @package core_grades
* @copyright 2022 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_grades extends behat_base {
/**
* Return the list of partial named selectors.
*
* @return array
*/
public static function get_partial_named_selectors(): array {
return [
new behat_component_named_selector(
'initials bar',
[".//*[contains(concat(' ', @class, ' '), ' initialbar ')]//span[contains(., %locator%)]/parent::div"]
),
new behat_component_named_selector(
'grade_actions',
["//td[count(//table[@id='user-grades']//th[contains(., %locator%)]/preceding-sibling::th)]//*[@data-type='grade']"]
),
new behat_component_named_selector(
'gradeitem modal',
[".//*[contains(concat(' ', @class, ' '), ' modal ')]"]
),
];
}
/**
* Convert page names to URLs for steps like 'When I am on the "[identifier]" "[page type]" page'.
*
* Recognised page names are:
* | pagetype | name meaning | description |
* | [report] view | Course name | The view page for the specified course and report |
* | gradebook setup | Course name | The gradebook setup page for the specified course |
* | course grade settings | Course name | The grade settings page |
* | outcomes | Course name | The grade outcomes page |
* | scales | Course name | The grade scales page |
*
* @param string $type identifies which type of page this is - for example "Grader > View"
* @param string $identifier identifies the particular page - for example "Course name"
* @return moodle_url the corresponding URL.
*/
protected function resolve_page_instance_url(string $type, string $identifier): moodle_url {
$type = strtolower($type);
if (strpos($type, '>') !== false) {
[$pluginname, $type] = explode('>', $type);
$pluginname = strtolower(trim($pluginname));
// Fetch the list of plugins.
$plugins = \core_component::get_plugin_list('gradereport');
if (array_key_exists($pluginname, $plugins)) {
$plugin = $pluginname;
} else {
$plugins = array_combine(
array_keys($plugins),
array_keys($plugins),
);
// This plugin is not in the list of plugins. Check the pluginname string.
$names = array_map(fn($name) => strtolower(get_string('pluginname', "gradereport_{$name}")), $plugins);
$result = array_search($pluginname, $names);
if ($result === false) {
throw new \coding_exception("Unknown plugin '{$pluginname}'");
}
$plugin = $result;
}
}
$type = trim($type);
switch ($type) {
case 'view':
return new moodle_url(
"/grade/report/{$plugin}/index.php",
['id' => $this->get_course_id($identifier)]
);
case 'gradebook setup':
return new moodle_url(
"/grade/edit/tree/index.php",
['id' => $this->get_course_id($identifier)]
);
case 'course grade settings':
return new moodle_url(
"/grade/edit/settings/index.php",
['id' => $this->get_course_id($identifier)]
);
case 'outcomes':
return new moodle_url(
"/grade/edit/outcome/course.php",
['id' => $this->get_course_id($identifier)]
);
case 'scales':
return new moodle_url(
"/grade/edit/scale/index.php",
['id' => $this->get_course_id($identifier)]
);
default:
throw new \coding_exception(
"Unknown page type '$type' for page identifier '$identifier'"
);
}
}
/**
* Select a given element within a specific container instance.
*
* @Given /^I select "(?P<input_value>(?:[^"]|\\")*)" in the "(?P<instance>(?:[^"]|\\")*)" "(?P<instance_type>(?:[^"]|\\")*)"$/
* @param string $value The Needle
* @param string $element The Haystack to select within
* @param string $selectortype What type of haystack we are looking in
*/
public function i_select_in_the($value, $element, $selectortype) {
// Getting the container where the text should be found.
$container = $this->get_selected_node($selectortype, $element);
if ($this->getSession()->getPage()->find('xpath', './/input[@value="' . $value . '"]')) {
$node = $this->find('xpath', './/input[@value="' . $value . '"]', false, $container);
$node->click();
} else {
$node = $this->find('xpath', './/button[@data-action="' . strtolower($value) . '"]', false, $container);
$node->press();
}
}
/**
* 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) {
$this->execute("behat_navigation::i_close_block_drawer_if_open");
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);
}
$node = $this->get_selected_node("xpath_element", $this->escape($xpath));
$this->execute_js_on_node($node, '{{ELEMENT}}.scrollIntoView({ block: "center", inline: "center" })');
$this->execute("behat_general::i_click_on", [$this->escape($xpath), "xpath_element"]);
}
}
@@ -0,0 +1,44 @@
@core @core_grades
Feature: Site settings can be used to hide parts of the gradebook UI
In order to hide UI elements
As an admin
I need to modify gradebook related system settings
Background:
Given the following "courses" exist:
| fullname | shortname | category | format |
| Course 1 | C1 | 0 | topics |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | assign1 | Assignment1 | Assignment 1 intro |
And I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
And I turn editing mode on
@javascript
Scenario: Hide minimum grade
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"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
Then I navigate to "Grades > General settings" in site administration
And I set the field "Show minimum grade" to "0"
And I press "Save changes"
And I am on the "Course 1" "grades > Grader report > View" page
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"
@javascript
Scenario: Disable category overriding
Given "Student 1 Course total" "field" should exist
And I navigate to "Grades > Grade category settings" in site administration
And I set the field "Allow category grades to be manually overridden" to "0"
And I press "Save changes"
When I am on the "Course 1" "grades > Grader report > View" page
Then "Student 1 Course total" "field" should not exist
+572
View File
@@ -0,0 +1,572 @@
@core @core_grades @javascript
Feature: We can use calculated grade totals
In order to calculate grade totals
As an teacher
I need to add aggregate columns to the gradebook
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
# Additional students must be enrolled in the course to ensure that the action menu for hiding grades is displayed correctly.
| student2 | Student | 2 | student2@example.com | s2 |
| student3 | Student | 3 | student3@example.com | s3 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Sub category 1 | C1 |
| Sub category 2 & | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one & | Submit something! | 300 |
| assign | C1 | a2 | Test assignment two | Submit something! | 100 |
| assign | C1 | a3 | Test assignment three | Submit something! | 150 |
| 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! | 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 the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory | grade |
| assign | C1 | a8 | Test assignment eight | Submit something! | Sub category 2 & | 20 |
| assign | C1 | a9 | Test assignment nine | Submit something! | Sub category 2 & | 10 |
| assign | C1 | 10 | Test assignment ten | Submit nothing! | Sub category 2 & | 15 |
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 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment one & | student1 | 60.00 |
| Test assignment two | student1 | 20.00 |
| Test assignment three | student1 | 40.00 |
| Test assignment five | student1 | 10.00 |
| Test assignment six | student1 | 5.00 |
| Test assignment eight | student1 | 10.00 |
| Test assignment nine | student1 | 5.00 |
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I change window size to "large"
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)"
And I press "Save changes"
Scenario: Mean of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Mean of grades |
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Mean of grades |
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 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
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "30.42 (30.42 %)" in the "overview-grade" "table"
Scenario: Weighted mean of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Weighted mean of grades |
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 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 set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| Item weight | 3 |
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
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "26.94 (26.94 %)" in the "overview-grade" "table"
Scenario: Simple weighted mean of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Simple weighted mean of grades |
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 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 set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| Extra credit | 1 |
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
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "48.57 (48.57 %)" in the "overview-grade" "table"
Scenario: Mean of grades (with extra credits) aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Mean of grades (with extra credits) |
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 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 set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| Extra credit weight | 2 |
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
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "47.22 (47.22 %)" in the "overview-grade" "table"
Scenario: Median of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Median of grades |
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Median of grades |
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"
And I turn editing mode off
Then I should see "26.67 (26.67 %)" in the ".course" "css_element"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "25.83 (25.83 %)" in the "overview-grade" "table"
Scenario: Lowest grade aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Lowest grade |
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Lowest grade |
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 set the following settings for grade item "Test assignment five" of type "gradeitem" on "grader" page:
| Hidden | 1 |
And I set the following settings for grade item "Test assignment four" of type "gradeitem" on "grader" page:
| Hidden | 1 |
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
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "0.00 (0.00 %)" in the "overview-grade" "table"
Scenario: Highest grade aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Highest grade |
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Highest grade |
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 set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| Hidden | 1 |
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
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "50.00 (50.00 %)" in the "overview-grade" "table"
Scenario: Mode of grades aggregation
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Mode of grades |
And I set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Mode of grades |
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 set the following settings for grade item "Test assignment one &" of type "gradeitem" on "grader" page:
| Hidden | 1 |
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
And I set the field "Hide totals if they contain hidden items" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "50.00 (50.00 %)" in the "overview-grade" "table"
Scenario: Natural aggregation on outcome items with natural weights
And the following config values are set as admin:
| enableoutcomes | 1 |
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Outcome 1 | OT1 | C1 | Test Scale |
And the following "grade items" exist:
| 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" of type "course" on "setup" page:
| Aggregation | Natural |
| Include outcomes in aggregation | 1 |
| Exclude empty grades | 0 |
And I change window size to "large"
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
And I press "Save changes"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
Then I should see "114.82 (18.27 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I set the following settings for grade item "Test outcome item one" of type "gradeitem" on "setup" page:
| aggregationcoef | 1 |
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
Then I should see "114.00 (18.39 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
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 press "Save"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
Then I should see "110.00 (17.74 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
Scenario: Natural aggregation on outcome items with modified weights
And the following config values are set as admin:
| enableoutcomes | 1 |
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Outcome 1 | OT1 | C1 | Test Scale |
And the following "grade items" exist:
| 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" 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" of type "gradeitem" on "setup" page:
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
And I change window size to "large"
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "Excellent" to the user "Student 1" for the grade item "Test outcome item one"
And I press "Save changes"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
Then I should see "4.00 (100.00 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And "Test outcome item one" row "Grade" column of "user-grade" table should contain "Excellent (100.00 %)"
Scenario: Natural aggregation
When I navigate to "View > Grader report" in the course gradebook
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 set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
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 set the following settings for grade item "Test assignment six" of type "gradeitem" on "grader" page:
| Weight adjusted | 1 |
| aggregationcoef2 | 50 |
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "grader" page:
| Extra credit | 1 |
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
And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "Show contribution to course total" to "Show"
And I set the field "Show weightings" to "Show"
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
And I set the field "View report as" to "Myself"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Contribution to course total |
| Test assignment five | 28.57 % | 10.00 (50.00 %) | 020 | 1.03 % |
| Test assignment six | 50.00 % | 5.00 (50.00 %) | 010 | 1.80 % |
| Test assignment seven | 21.43 % | - | 015 | 0.00 % |
| Test assignment eight | 66.67 % | 10.00 (50.00 %) | 020 | 1.60 % |
| Test assignment nine | 33.33 % | 5.00 (50.00 %) | 010 | 0.80 % |
| Test assignment ten | 0.00 %( Empty ) | - | 015 | 0.00 % |
| Test assignment one & | 48.00 % | 60.00 (20.00 %) | 0300 | 9.60 % |
| Test assignment two | 16.00 % | 20.00 (20.00 %) | 0100 | 3.20 % |
| Test assignment three | 24.00 %( Extra credit ) | 40.00 (26.67 %) | 0150 | 6.40 % |
| Test assignment four | 24.00 % | - | 0150 | 0.00 % |
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "113.75 (23.45 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Contribution to course total |
| Test assignment six | 70.00 % | 5.00 (50.00 %) | 010 | 1.80 % |
| Test assignment seven | 30.00 % | - | 015 | 0.00 % |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 010 | 1.03 % |
| Test assignment ten | -( Empty ) | - | 015 | - |
| Test assignment one & | 61.86 % | 60.00 (20.00 %) | 0300 | 12.37 % |
| Test assignment three | 30.93 %( Extra credit ) | 40.00 (26.67 %) | 0150 | 8.25 % |
| Test assignment four | 30.93 % | - | 0150 | 0.00 % |
Scenario: Natural aggregation with drop lowest
When I am on the "Course 1" "grades > Grader report > View" page logged in as "admin"
And I turn editing mode on
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 set the following settings for grade item "Sub category 1" of type "category" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
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 navigate to "Setup > Gradebook setup" in the course gradebook
And I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Sub category 3 |
| Aggregation | Natural |
| Drop the lowest | 1 |
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 1 |
| Grade category | Sub category 3 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 2 |
| Grade category | Sub category 3 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 3 |
| Grade category | Sub category 3 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I navigate to "View > Grader report" in the course gradebook
And I give the grade "60.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
And I give the grade "40.00" to the user "Student 1" for the grade item "Manual item 3"
And I press "Save changes"
And I turn editing mode off
Then I should see "250.00 (25.25 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
| Extra credit | 1 |
And I turn editing mode off
And I should see "270.00 (27.27 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
| Rescale existing grades | No |
| Maximum grade | 200 |
| Extra credit | 0 |
# 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"
And I press "Save changes"
And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
And I press "Save changes"
And I turn editing mode off
And I should see "270.00 (22.69 %)" in the ".course" "css_element"
And I turn editing mode on
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "grader" page:
| Rescale existing grades | No |
| Maximum grade | 100 |
| Extra credit | 0 |
# 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"
And I press "Save changes"
And I give the grade "20.00" to the user "Student 1" for the grade item "Manual item 2"
And I press "Save changes"
And I turn editing mode off
And I should see "250.00 (25.25 %)" in the ".course" "css_element"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Sub sub category 1 |
| Parent category | Sub category 3 |
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I navigate to "View > Grader report" in the course gradebook
And I should see "270.00 (24.77 %)" in the ".course" "css_element"
Scenario: Natural aggregation from the setup screen
When I navigate to "Setup > Gradebook setup" in the course gradebook
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" of type "category" on "setup" page:
| Aggregation | Natural |
And I set the following settings for grade item "Sub category 2 &" of type "category" on "setup" page:
| Aggregation | Natural |
And the field "Weight of Test assignment one &" matches value "37.975"
And the field "Weight of Test assignment two" matches value "12.658"
And the field "Weight of Sub category 1" matches value "5.696"
And the field "Weight of Sub category 2" matches value "5.696"
And I set the field "Override weight of Test assignment one &" to "1"
And I set the field "Weight of Test assignment one &" to "10"
And the field "Weight of Test assignment two" matches value "18.367"
And the field "Weight of Sub category 1" matches value "8.265"
And the field "Weight of Sub category 2" matches value "8.265"
And I set the field "Override weight of Test assignment two" to "1"
And I set the field "Override weight of Test assignment two" to "0"
And the field "Weight of Test assignment six" matches value "22.222"
And I set the field "Override weight of Test assignment six" to "1"
And I set the field "Weight of Test assignment six" to "50"
And I set the field "Override weight of Test assignment six" to "0"
And the field "Weight of Test assignment six" matches value "22.222"
And the field "Weight of Test assignment ten" matches value "33.333"
And I set the field "Override weight of Test assignment ten" to "1"
And I set the field "Weight of Test assignment ten" to "50"
And I set the field "Override weight of Sub category 1" to "1"
And I set the field "Weight of Sub category 1" to "15"
Then the field "Weight of Test assignment one &" matches value "10.0"
And the field "Weight of Test assignment two" matches value "16.854"
And the field "Weight of Test assignment six" matches value "22.222"
And the field "Weight of Test assignment ten" matches value "50.0"
And the field "Weight of Sub category 1" matches value "15.0"
And I press "Save changes"
Then the field "Weight of Test assignment one &" matches value "10.0"
And the field "Weight of Test assignment two" matches value "16.854"
And the field "Weight of Test assignment six" matches value "22.222"
And the field "Weight of Test assignment ten" matches value "50.0"
And the field "Weight of Sub category 1" matches value "15.0"
And I set the field "Override weight of Test assignment one &" to "0"
And I set the field "Override weight of Test assignment two" to "0"
And I set the field "Override weight of Test assignment six" to "0"
And I set the field "Override weight of Sub category 1" to "0"
And the field "Weight of Test assignment one &" matches value "37.975"
And the field "Weight of Sub category 1" matches value "5.696"
And I press "Save changes"
And the field "Weight of Test assignment one &" matches value "37.975"
And the field "Weight of Sub category 1" matches value "5.696"
And I reset weights for grade category "Sub category 2 &"
And the field "Weight of Test assignment ten" matches value "33.333"
Scenario: Natural aggregation with weights of zero
When I navigate to "View > Grader report" in the course gradebook
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
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 set the following settings for grade item "Sub category 2 &" of type "category" on "grader" page:
| Aggregation | Natural |
| Exclude empty grades | 0 |
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
And "//span[@class='grateitemheader'][@title='Link to Test assignment one &amp; Assignment']" "xpath_element" should not exist
And I set the field "Override weight of Test assignment one &" to "1"
And I set the field "Weight of Test assignment one &" to "0"
And I should see "490.00" in the "Course total" "table_row"
And I set the field "Override weight of Test assignment six" to "1"
And I set the field "Weight of Test assignment six" to "0"
And I should see "480.00" in the "Course total" "table_row"
And I set the field "Override weight of Test assignment nine" to "1"
And I set the field "Weight of Test assignment nine" to "100"
And I press "Save changes"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "report_overview_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I set the field "Show contribution to course total" to "Show"
And I set the field "Show weightings" to "Show"
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
Then I should see "75.00 (16.85 %)" in the ".course" "css_element"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And I set the field "View report as" to "Myself"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment five | 57.14 % | 10.00 (50.00 %) | 2.25 % |
| Test assignment six | 0.00 % | 5.00 (50.00 %) | 0.00 % |
| Test assignment seven | 42.86 % | - | 0.00 % |
| Test assignment eight | 0.00 % | 10.00 (50.00 %) | 0.00 % |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 1.12 % |
| Test assignment ten | 0.00 % | - | 0.00 % |
| Test assignment one & | 0.00 % | 60.00 (20.00 %) | 0.00 % |
| Test assignment two | 22.47 % | 20.00 (20.00 %) | 4.49 % |
| Test assignment three | 33.71 % | 40.00 (26.67 %) | 8.99 % |
| Test assignment four | 33.71 % | - | 0.00 |
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I should see "45.00 (13.85 %)" in the "overview-grade" "table"
And I click on "Course 1" "link" in the "region-main" "region"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Test assignment six | 0.00 % | 5.00 (50.00 %) | 0.00 % |
| Test assignment seven | 100.00 % | - | 0.00 % |
| Test assignment nine | 100.00 % | 5.00 (50.00 %) | 1.54 % |
| Test assignment ten | 0.00 | - | 0.00 % |
| Test assignment one & | 0.00 % | 60.00 (20.00 %) | 0.00 % |
| Test assignment three | 46.15 % | 40.00 (26.67 %) | 12.31 % |
| Test assignment four | 46.15 % | - | 0.00 % |
@@ -0,0 +1,590 @@
@core @core_grades @javascript
Feature: Changing the aggregation of an item affects its weight and extra credit definition
In order to switch to another aggregation method
As an teacher
I need to be able to edit the grade category settings
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "grade categories" exist:
| fullname | course | aggregation |
| Cat mean | C1 | 0 |
| Cat median | C1 | 2 |
| Cat min | C1 | 4 |
| Cat max | C1 | 6 |
| Cat mode | C1 | 8 |
| Cat weighted | C1 | 10 |
| Cat weighted2 | C1 | 10 |
| Cat simple | C1 | 11 |
| Cat ec | C1 | 12 |
| Cat natural & | C1 | 13 |
And the following "grade items" exist:
| itemname | course | category | aggregationcoef | aggregationcoef2 | weightoverride |
| Item a1 | C1 | ? | 0 | 0 | 0 |
| Item a2 | C1 | ? | 0 | 0.40 | 1 |
| Item a3 | C1 | ? | 1 | 0.10 | 1 |
| Item a4 | C1 | ? | 1 | 0 | 0 |
| Item b1 | C1 | Cat natural & | 0 | 0 | 0 |
| Item b2 | C1 | Cat natural & | 0 | 0.40 | 1 |
| Item b3 | C1 | Cat natural & | 1 | 0.10 | 1 |
| Item b4 | C1 | Cat natural & | 1 | 0 | 0 |
And I log in as "admin"
And I change window size to "large"
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 |
And I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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" 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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 "Weight" matches value "40.0"
And the field "Extra credit" matches value "0"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 "Weight" matches value "10.0"
And the field "Extra credit" matches value "1"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 "Weight" matches value "40.0"
And the field "Extra credit" matches value "0"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 "Weight" matches value "10.0"
And the field "Extra credit" matches value "1"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
Scenario: Switching a category from Natural aggregation to Mean of grades and back
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 click on "Save" "button" in the "Edit category" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 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 click on "Save" "button" in the "Edit category" "dialogue"
And I wait until the page is ready
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Switching back.
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 click on "Save" "button" in the "Edit category" "dialogue"
And I wait until the page is ready
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 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 click on "Save" "button" in the "Edit category" "dialogue"
And I wait until the page is ready
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
Scenario: Switching a category from Natural aggregation to Weighted mean of grades and back
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 click on "Save" "button" in the "Edit category" "dialogue"
And I wait until the page is ready
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 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 click on "Save" "button" in the "Edit category" "dialogue"
And I wait until the page is ready
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Switching back.
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 click on "Save" "button" in the "Edit category" "dialogue"
And I wait until the page is ready
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat median" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 item menu "Cat min" of type "category" on "grader" page
And I choose "Edit category" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 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 click on "Save" "button" in the "Edit category" "dialogue"
And I wait until the page is ready
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
Scenario: Switching grade items between categories
# Move to same aggregation (Natural).
Given I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Select Item a1" to "1"
And I set the field "Select Item a2" to "1"
And I set the field "Select Item a3" to "1"
And I set the field "Select Item a4" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
And I click on "Cat natural &" "list_item" in the "Move items" "dialogue"
When I click on "Move" "button" in the "Move items" "dialogue"
And I navigate to "View > Grader report" in the course gradebook
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 "Weight" matches value "40.0"
And the field "Extra credit" matches value "0"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 "Weight" matches value "10.0"
And the field "Extra credit" matches value "1"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Move to Mean of grades (with extra credit).
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Select Item a1" to "1"
And I set the field "Select Item a2" to "1"
And I set the field "Select Item a3" to "1"
And I set the field "Select Item a4" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
And I click on "Cat ec" "list_item" in the "Move items" "dialogue"
And I click on "Move" "button" in the "Move items" "dialogue"
And I navigate to "View > Grader report" in the course gradebook
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Move to Simple weight mean of grades.
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Select Item a1" to "1"
And I set the field "Select Item a2" to "1"
And I set the field "Select Item a3" to "1"
And I set the field "Select Item a4" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
And I click on "Cat simple" "list_item" in the "Move items" "dialogue"
And I click on "Move" "button" in the "Move items" "dialogue"
And I navigate to "View > Grader report" in the course gradebook
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Move to Weighted mean of grades.
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Select Item a1" to "1"
And I set the field "Select Item a2" to "1"
And I set the field "Select Item a3" to "1"
And I set the field "Select Item a4" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
And I click on "Cat weighted" "list_item" in the "Move items" "dialogue"
And I click on "Move" "button" in the "Move items" "dialogue"
And I navigate to "View > Grader report" in the course gradebook
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 click on "Save" "button" in the "Edit grade item" "dialogue"
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 click on "Save" "button" in the "Edit grade item" "dialogue"
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 click on "Save" "button" in the "Edit grade item" "dialogue"
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"
And I click on "Save" "button" in the "Edit grade item" "dialogue"
# Move to same (Weighted mean of grades).
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Select Item a1" to "1"
And I set the field "Select Item a2" to "1"
And I set the field "Select Item a3" to "1"
And I set the field "Select Item a4" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
And I click on "Cat weighted2" "list_item" in the "Move items" "dialogue"
And I click on "Move" "button" in the "Move items" "dialogue"
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" 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 click on "Save" "button" in the "Edit grade item" "dialogue"
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 click on "Save" "button" in the "Edit grade item" "dialogue"
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 click on "Save" "button" in the "Edit grade item" "dialogue"
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 click on "Save" "button" in the "Edit grade item" "dialogue"
# Move back to Natural.
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Select Item a1" to "1"
And I set the field "Select Item a2" to "1"
And I set the field "Select Item a3" to "1"
And I set the field "Select Item a4" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
And I click on "Cat natural &" "list_item" in the "Move items" "dialogue"
And I click on "Move" "button" in the "Move items" "dialogue"
And I navigate to "View > Grader report" in the course gradebook
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
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 click on "Cancel" "button" in the "Edit grade item" "dialogue"
+129
View File
@@ -0,0 +1,129 @@
@core @core_grades @javascript
Feature: Average grades are displayed in the gradebook
In order to check the expected results are displayed
As an admin
I need to assign grades and check that they display correctly in the gradebook.
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "users" exist:
# Teacher 1 is user without preferences set, Teacher 2 is user with preferences set
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| teacher2 | Teacher | 2 | teacher2@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
| student4 | Student | 4 | student4@example.com |
| student5 | Student | 5 | student5@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
| student5 | C1 | student |
And the following "grade item" exists:
| course | C1 |
| itemname | Manual item 1 |
And the following "grade grades" exist:
| gradeitem | user | grade | hidden |
| Manual item 1 | student1 | 10.00 | 0 |
| Manual item 1 | student2 | 20.00 | 0 |
| Manual item 1 | student3 | 30.00 | 0 |
| Manual item 1 | student4 | 40.00 | 1 |
| Manual item 1 | student5 | 50.00 | 0 |
And the following "course enrolments" exist:
| user | course | role | status |
| student2 | C1 | student | suspended |
And I log in as "admin"
And I navigate to "Users > Accounts > Browse list of users" in site administration
And I press "Delete" action in the "Student 5" report row
And I click on "Delete" "button" in the "Delete user" "dialogue"
# Enable averages
And I am on the "Course 1" "grades > course grade settings" page
And I set the following fields to these values:
| Show average | Show |
And I press "Save changes"
Scenario: Grade averages display correctly in the gradebook according to various settings
# Check the admin grade table
Given I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
# Average is (10 + 30 + 40)/3 = 26.67 for manual and total since hidden items are included on grader report
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Overall average | 26.67 | 26.67 |
And I am on the "Course 1" "grades > Grade summary > View" page
# Average is (10 + 20 + 30)/3 = 30.00 for manual since
# 1. Hidden items are NOT included on grader report.
# 2. There is a bug when we have suspended users in the course so here Student 2 is included.
# So the average is not write when preference is either not set or set to 0.
# Possibly this should be changed later to match grader report.
And I should see "30.00" in the "Manual item 1" "table_row"
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher2"
And the following "user preferences" exist:
| user | preference | value |
| teacher2 | grade_report_showonlyactiveenrol | 1 |
And I am on the "Course 1" "grades > Grader report > View" page
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Overall average | 26.67 | 26.67 |
And I am on the "Course 1" "grades > Grade summary > View" page
# Average is (10 + 30)/2 = 20.00 for manual (when preference is set to 1 set average is correct).
And I should see "20.00" in the "Manual item 1" "table_row"
And the following "user preferences" exist:
| user | preference | value |
| teacher2 | grade_report_showonlyactiveenrol | 0 |
And I am on the "Course 1" "grades > Grader report > View" page
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Overall average | 25.00 | 25.00 |
And I am on the "Course 1" "grades > Grade summary > View" page
# Average is (10 + 30)/2 = 20.00 for manual (when preference is set to 0 set average is NOT correct).
And I should see "20.00" in the "Manual item 1" "table_row"
# Check the user grade table
When I am on the "Course 1" "grades > user > View" page logged in as "student1"
# Average of manual item is (10 + 30)/2 = 20.00 since hidden items are not included on user report.
# But total is calculated and its settings allow using hidden grades so it will stay the same.
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Average | Contribution to course total |
| Manual item 1 | 100.00 % | 10.00 | 0100 | 10.00 % | 20.00 | 10.00 % |
| Course total | - | 10.00 | 0100 | 10.00 % | 26.67 | - |
# Default grade_report_showonlyactiveenrol is 1 so change that
And the following config values are set as admin:
| grade_report_showonlyactiveenrol | 0 |
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher2"
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Overall average | 25.00 | 25.00 |
And I am on the "Course 1" "grades > Grade summary > View" page
And I should see "20.00" in the "Manual item 1" "table_row"
And the following "user preferences" exist:
| user | preference | value |
| teacher2 | grade_report_showonlyactiveenrol | 1 |
And I am on the "Course 1" "grades > Grader report > View" page
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Overall average | 26.67 | 26.67 |
And I am on the "Course 1" "grades > Grade summary > View" page
And I should see "20.00" in the "Manual item 1" "table_row"
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- |
| Overall average | 25.00 | 25.00 |
And I am on the "Course 1" "grades > Grade summary > View" page
And I should see "20.00" in the "Manual item 1" "table_row"
And I am on the "Course 1" "grades > user > View" page logged in as "student1"
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Average | Contribution to course total |
| Manual item 1 | 100.00 % | 10.00 | 0100 | 10.00 % | 20.00 | 10.00 % |
| Course total | - | 10.00 | 0100 | 10.00 % | 26.67 | - |
@@ -0,0 +1,165 @@
@core @core_grades
Feature: Calculated grade items can be used in the gradebook
In order to use calculated grade items in the gradebook
As a teacher
I need setup calculated grade items in the 'Gradebook setup' page.
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
@javascript
Scenario: The max grade for a category item, with a calculation using Natural aggregation, can be changed
Given I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Calc cat |
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | grade item 1 |
| Grade category | Calc cat |
And I click on "Save" "button" in the "New grade item" "dialogue"
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" 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
And I give the grade "75.00" to the user "Student 1" for the grade item "grade item 1"
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 050 | 75.00 % | - |
| Course total | - | 37.50 | 050 | 75.00 % | - |
@javascript
Scenario: Changing max grade for a category item with a calculation that has existing grades will display the same points with the new max grade values immediately.
Given I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Calc cat |
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I should not see "Calculated grade" in the "Calc cat" "table_row"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | grade item 1 |
| Grade category | Calc cat |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 |
And I should see "Calculated grade" in the "Calc cat" "table_row"
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
And I give the grade "75.00" to the user "Student 1" for the grade item "grade item 1"
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 050 | 75.00 % | - |
| Course total | - | 37.50 | 050 | 75.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
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"
And I press "Save changes"
And I navigate to "View > User report" in the course gradebook
When I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 040 | 93.75 % | - |
| Course total | - | 37.50 | 040 | 93.75 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 65.00 | 0100 | 65.00 % | - |
| Calc cat total | 100.00 % | 32.50 | 040 | 81.25 % | - |
| Course total | - | 32.50 | 040 | 81.25 % | - |
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the following fields to these values:
| Min and max grades used in calculation | Initial min and max grades |
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 040 | 93.75 % | - |
| Course total | - | 37.50 | 040 | 93.75 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 65.00 | 0100 | 65.00 % | - |
| Calc cat total | 100.00 % | 32.50 | 040 | 81.25 % | - |
| Course total | - | 32.50 | 040 | 81.25 % | - |
@javascript
Scenario: Values in calculated grade items are not always out of one hundred
Given I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | grade item 1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | calc item |
And I click on "Save" "button" in the "New grade item" "dialogue"
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" 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:
| Min and max grades used in calculation | Initial min and max grades |
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 "75.00" to the user "Student 1" for the grade item "grade item 1"
And I press "Save changes"
And I navigate to "View > User report" in the course gradebook
When I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 66.67 % | 75.00 | 0100 | 75.00 % | 50.00 % |
| calc item | 33.33 % | 37.50 | 050 | 75.00 % | 25.00 % |
| Course total | - | 112.50 | 0150 | 75.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
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
And I give the grade "65.00" to the user "Student 2" for the grade item "grade item 1"
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 71.43 % | 75.00 | 0100 | 75.00 % | 53.57 % |
| calc item | 28.57 % | 37.50 | 040 | 93.75 % | 26.79 % |
| Course total | - | 112.50 | 0140 | 80.36 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 71.43 % | 65.00 | 0100 | 65.00 % | 46.43 % |
| calc item | 28.57 % | 32.50 | 040 | 81.25 % | 23.21 % |
| Course total | - | 97.50 | 0140 | 69.64 % | - |
@@ -0,0 +1,164 @@
@core @core_grades
Feature: Gradebook calculations for calculated grade items before the fix 20150627
In order to make sure the grades are not changed after upgrade
As a teacher
I need to be able to freeze gradebook calculations
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And gradebook calculations for the course "C1" are frozen at version "20150627"
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
@javascript
Scenario: The max grade for a category item, with a calculation using Natural aggregation, can be changed
Given I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Calc cat |
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | grade item 1 |
| Grade category | Calc cat |
And I click on "Save" "button" in the "New grade item" "dialogue"
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" 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
And I give the grade "75.00" to the user "Student 1" for the grade item "grade item 1"
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 0100 | 37.50 % | - |
| Course total | - | 37.50 | 0100 | 37.50 % | - |
@javascript
Scenario: Changing max grade for a category item with a calculation that has existing grades will display the same points with the new max grade values immediately.
Given I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Calc cat |
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | grade item 1 |
| Grade category | Calc cat |
And I click on "Save" "button" in the "New grade item" "dialogue"
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" 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
And I give the grade "75.00" to the user "Student 1" for the grade item "grade item 1"
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 0100 | 37.50 % | - |
| Course total | - | 37.50 | 0100 | 37.50 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
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"
And I press "Save changes"
And I navigate to "View > User report" in the course gradebook
When I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 0100 | 37.50 % | - |
| Course total | - | 37.50 | 0100 | 37.50 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 65.00 | 0100 | 65.00 % | - |
| Calc cat total | 100.00 % | 32.50 | 0100 | 32.50 % | - |
| Course total | - | 32.50 | 0100 | 32.50 % | - |
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the following fields to these values:
| Min and max grades used in calculation | Initial min and max grades |
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 75.00 | 0100 | 75.00 % | - |
| Calc cat total | 100.00 % | 37.50 | 0100 | 37.50 % | - |
| Course total | - | 37.50 | 0100 | 37.50 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | - | 65.00 | 0100 | 65.00 % | - |
| Calc cat total | 100.00 % | 32.50 | 0100 | 32.50 % | - |
| Course total | - | 32.50 | 0100 | 32.50 % | - |
@javascript
Scenario: Values in calculated grade items are not always out of one hundred
Given I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | grade item 1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | calc item |
And I click on "Save" "button" in the "New grade item" "dialogue"
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" 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:
| Min and max grades used in calculation | Initial min and max grades |
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 "75.00" to the user "Student 1" for the grade item "grade item 1"
And I press "Save changes"
And I navigate to "View > User report" in the course gradebook
When I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 50.00 % | 75.00 | 0100 | 75.00 % | 37.50 % |
| calc item | 50.00 % | 37.50 | 0100 | 37.50 % | 18.75 % |
| Course total | - | 112.50 | 0200 | 56.25 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
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
And I give the grade "65.00" to the user "Student 2" for the grade item "grade item 1"
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 50.00 % | 75.00 | 0100 | 75.00 % | 37.50 % |
| calc item | 50.00 % | 37.50 | 0100 | 37.50 % | 18.75 % |
| Course total | - | 112.50 | 0200 | 56.25 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| grade item 1 | 50.00 % | 65.00 | 0100 | 65.00 % | 32.50 % |
| calc item | 50.00 % | 32.50 | 0100 | 32.50 % | 16.25 % |
| Course total | - | 97.50 | 0200 | 48.75 % | - |
@@ -0,0 +1,246 @@
@core @core_grades
Feature: We can understand the gradebook user report
In order to understand the gradebook user report
As an teacher
I need to see the calculated weights for each type of aggregation
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| 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 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Test assignment one | student1 | 60.00 |
| Test assignment two | student1 | 20.00 |
| Test assignment three | student1 | 40.00 |
| Test assignment four | student1 | 10.00 |
| Test assignment five | student1 | 70.00 |
| Test assignment six | student1 | 30.00 |
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
And I set the field "Show weightings" to "Show"
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 choose the "Add category" item in the "Add" action menu
And I set the field "Category name" to "Sub category"
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
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 "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 "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" 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 |
| 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" of type "course" on "setup" page:
| Aggregation | Weighted mean of grades |
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 "Test assignment two" of type "gradeitem" on "setup" page:
| Item weight | 1.0 |
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 "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 |
| 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" of type "course" on "setup" page:
| Aggregation | Simple weighted mean of grades |
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 "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 |
| 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" of type "course" on "setup" page:
| Aggregation | Mean of grades (with extra credits) |
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 |
| 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" 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 |
| 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" 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 |
| 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" 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 |
| 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" 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 |
| 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 change window size to "large"
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" of type "category" on "setup" page:
| Aggregation | Weighted mean of grades |
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| aggregationcoef | 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 |
| 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 total | 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 "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 |
| 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 | - |
@@ -0,0 +1,120 @@
@core_grades @javascript
Feature: Editing a grade item
In order to ensure validation is provided to the teacher
As a teacher
I need to know why I can not add/edit values on the grade category form
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "scales" exist:
| name | scale |
| ABCDEF | F,E,D,C,B,A |
| Letter scale | Disappointing, Good, Very good, Excellent |
And the following "grade categories" exist:
| fullname | course | aggregation |
| Cat 1 | C1 | 6 |
And the following "grade items" exist:
| itemname | course | category |
| Item 1 | C1 | Cat 1 |
| Item 2 | C1 | Cat 1 |
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
Scenario: Being able to change the grade type, scale and maximum grade for a grade category when there are no overridden grades
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 "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 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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 "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 "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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 "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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
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 "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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"
And the "Maximum grade" "field" should be disabled
Scenario: Perform changes to a grade category with custom decimal separator
Given the following "language customisations" exist:
| component | stringid | value |
| 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 "Cat 1 total"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
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"
When I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I click on user menu "Student 1"
And I choose "Single view for this user" in the open action menu
Then I should see "Student 1"
And the field "Grade for Category total" matches value "17#50"
@@ -0,0 +1,75 @@
@core @core_grades @javascript
Feature: Extra credit contributions are normalised when going out of bounds
In order to use extra credit
As a teacher
I need to add some extra credit items.
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "admin"
And I set the following administration settings values:
| grade_aggregations_visible | Simple weighted mean of grades,Mean of grades (with extra credits),Natural |
And I am on the "Course 1" "grades > gradebook setup" page
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 1 |
| Maximum grade | 150 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 2 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 3 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 4 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Show weighting" to "Show"
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "10.00" to the user "Student 1" for the grade item "Manual item 2"
And I give the grade "70.00" to the user "Student 1" for the grade item "Manual item 3"
And I give the grade "90.00" to the user "Student 1" for the grade item "Manual item 4"
And I press "Save changes"
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" of type "course" on "setup" page:
| Aggregation | <aggregation> |
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "setup" page:
| aggregationcoef | 1 |
And I set the following settings for grade item "Manual item 3" of type "gradeitem" on "setup" page:
| aggregationcoef | 1 |
And I set the following settings for grade item "Manual item 4" of type "gradeitem" on "setup" page:
| aggregationcoef | 1 |
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:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Manual item 1 | <m1w> | 80.00 | <m1c> |
| Manual item 2 | <m2w> | 10.00 | <m2c> |
| Manual item 3 | <m3w> | 70.00 | <m3c> |
| Manual item 4 | 0.00 % | 90.00 | 0.00 % |
Examples:
| aggregation | m1w | m1c | m2w | m2c | m3w | m3c |
| Natural | 100.00 % | 53.33 % | 66.67 % | 6.67 % | 57.14 % | 40.00 % |
| Simple weighted mean of grades | 100.00 % | 53.33 % | 66.67 % | 6.67 % | 57.14 % | 40.00 % |
| Mean of grades (with extra credits) | 100.00 % | 53.33 % | 100.00 % | 10.00 % | 52.38 % | 36.67 % |
@@ -0,0 +1,267 @@
@core @core_grades @javascript
Feature: Teachers can perform bulk actions on grade items and categories in the gradebook setup
In order to be able to easily organize my gradebook
As a teacher
I need to be able to select multiple grade items and categories and perform bulk actions on them
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher 1 | 1 | teacher1@example.com | t1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "grade categories" exist:
| fullname | course |
| Category 1 | C1 |
And the following "grade categories" exist:
| fullname | course | gradecategory |
| Category 2 | C1 | Category 1 |
| Category 3 | C1 | Category 2 |
And the following "grade items" exist:
| itemname | course | category |
| Grade item 1 | C1 | ? |
| Grade item 2 | C1 | Category 1 |
| Grade item 3 | C1 | Category 1 |
| Grade item 4 | C1 | Category 2 |
And I log in as "teacher1"
And I am on "Course" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
Scenario: A teacher can see bulk action options in the gradebook setup
# Bulk action options should not be displayed until at least one grade item is selected.
Given I should not see "Move" in the "sticky-footer" "region"
When I set the field "Grade item 1" to "1"
Then I should see "Move" in the "sticky-footer" "region"
And I set the field "Grade item 2" to "1"
And I should see "Move" in the "sticky-footer" "region"
# Unchecking all grade items should hide the bulk action area.
And I set the following fields to these values:
| Grade item 1 | 0 |
| Grade item 2 | 0 |
And I should not see "Move" in the "sticky-footer" "region"
Scenario: A teacher can see the number of selected grade items and categories in the bulk action area
Given I set the field "Grade item 1" to "1"
# Selecting a grade category should also select all grade items in that category.
When I set the field "Category 2" to "1"
Then I should see "4 selected" in the "sticky-footer" "region"
And I set the field "Category 2" to "0"
And I should see "1 selected" in the "sticky-footer" "region"
And I set the field "All" to "1"
And I should see "8 selected" in the "sticky-footer" "region"
And I set the field "All" to "0"
And I should not see "selected" in the "sticky-footer" "region"
Scenario: A teacher can unselect all grade items and categories in the bulk action area
Given I set the following fields to these values:
| Grade item 1 | 1 |
| Category 2 | 1 |
And I should see "4 selected" in the "sticky-footer" "region"
And "Close bulk edit" "button" should exist in the "sticky-footer" "region"
When I click on "Close bulk edit" "button" in the "sticky-footer" "region"
Then the following fields match these values:
| All | 0 |
| Grade item 1 | 0 |
| Category 1 | 0 |
| Grade item 2 | 0 |
| Grade item 3 | 0 |
| Category 2 | 0 |
| Grade item 4 | 0 |
| Category 3 | 0 |
And "Close bulk edit" "button" should not exist in the "sticky-footer" "region"
Scenario: A teacher can see bulk move modal with all available grade categories
Given I set the field "Grade item 1" to "1"
When I click on "Move" "button" in the "sticky-footer" "region"
Then "Move items" "dialogue" should exist
And "Course" "list_item" should exist in the "Move items" "dialogue"
And "Category 1" "list_item" should exist in the "Move items" "dialogue"
And "Category 2" "list_item" should exist in the "Move items" "dialogue"
And "Category 3" "list_item" should exist in the "Move items" "dialogue"
Scenario: A teacher can collapse grade categories in the bulk move modal
Given I set the field "Grade item 1" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
# Collapse "Category 2" category.
When I click on "Collapse" "link" in the "Category 2" "list_item"
Then "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
And "Expand" "link" should exist in the "Category 2" "list_item"
# Collapse "Category 1" category.
And I click on "Collapse" "link" in the "Category 1" "list_item"
And "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should not be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
And "Expand" "link" should exist in the "Category 1" "list_item"
# Expand "Category 1" category.
And I click on "Expand" "link" in the "Category 1" "list_item"
And "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
And "Collapse" "link" should exist in the "Category 1" "list_item"
# Expand "Category 2" category.
And I click on "Expand" "link" in the "Category 2" "list_item"
And "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should be visible
And "Collapse" "link" should exist in the "Category 2" "list_item"
Scenario: A teacher can move multiple grade items to a category
Given I set the field "Grade item 2" to "1"
And I set the field "Grade item 1" to "1"
And I click on "Move" "button" in the "sticky-footer" "region"
And I click on "Category 3" "list_item" in the "Move items" "dialogue"
And I click on "Move" "button" in the "Move items" "dialogue"
And I wait to be redirected
# Confirm that 'Grade item 1' and 'Grade item 2' have been moved to 'Category 3'
And I click on grade item menu "Grade item 1" of type "gradeitem" on "setup" page
When I choose "Edit grade item" in the open action menu
And "Edit grade item" "dialogue" should exist
Then I should see "Category 3" in the "Grade category" "form_row"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
And I click on grade item menu "Grade item 2" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And "Edit grade item" "dialogue" should exist
And I should see "Category 3" in the "Grade category" "form_row"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Confirm that all other grade items have not been moved.
And I click on grade item menu "Grade item 3" of type "gradeitem" on "setup" page
When I choose "Edit grade item" in the open action menu
And I wait until "Edit grade item" "dialogue" exists
Then I should see "Category 1" in the "Grade category" "form_row"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
And I click on grade item menu "Grade item 4" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I wait until "Edit grade item" "dialogue" exists
And I should see "Category 2" in the "Grade category" "form_row"
@accessibility
Scenario: A teacher can navigate through the grade categories in the bulk modal using the keyboard
Given I set the field "Grade item 1" to "1"
And I press tab key in "sticky-footer" "region"
And the focused element is "Move" "button" in the "sticky-footer" "region"
And I press enter
And "Move items" "dialogue" should exist
And I press tab
And the focused element is "Close" "button" in the "Move items" "dialogue"
And I press tab
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
# Move to the next grade category.
When I press the down key
Then the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
And I press the down key
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
# Move to the previous grade category.
And I press the up key
And the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
And I press the up key
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
# Move to the last grade category.
And I press the end key
And the focused element is "Category 3" "list_item" in the "Move items" "dialogue"
# Move to the first grade category.
And I press the home key
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
@accessibility
Scenario: A teacher can collapse and expand the grade categories in the bulk modal using the keyboard
Given I set the field "Grade item 1" to "1"
And I press tab key in "sticky-footer" "region"
And the focused element is "Move" "button" in the "sticky-footer" "region"
And I press enter
And "Move items" "dialogue" should exist
And I press tab
And the focused element is "Close" "button" in the "Move items" "dialogue"
And I press tab
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
And I press the down key
Then the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
And I press the down key
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
And "Collapse" "link" should exist in the "Category 2" "list_item"
# Collapse "Category 2" category.
When I press the left key
Then "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
And "Expand" "link" should exist in the "Category 2" "list_item"
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
And the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
And "Collapse" "link" should exist in the "Category 2" "list_item"
# Collapse "Category 1" category.
And I press the left key
And "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should not be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
And "Expand" "link" should exist in the "Category 1" "list_item"
And I press the down key
# Expand "Category 1" category.
And I press the right key
And "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should not be visible
And "Collapse" "link" should exist in the "Category 1" "list_item"
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
# Expand "Category 2" category.
And I press the right key
And "Course" "list_item" in the "Move items" "dialogue" should be visible
And "Category 1" "list_item" in the "Move items" "dialogue" should be visible
And "Category 2" "list_item" in the "Move items" "dialogue" should be visible
And "Category 3" "list_item" in the "Move items" "dialogue" should be visible
And "Collapse" "link" should exist in the "Category 2" "list_item"
@accessibility
Scenario: A teacher can move multiple items to a category using the keyboard
Given I set the following fields to these values:
| Grade item 1 | 1 |
| Grade item 2 | 1 |
And I press tab key in "sticky-footer" "region"
And the focused element is "Move" "button" in the "sticky-footer" "region"
And I press enter
And "Move items" "dialogue" should exist
And I press tab
And the focused element is "Close" "button" in the "Move items" "dialogue"
And I press tab
And the focused element is "Course" "list_item" in the "Move items" "dialogue"
And I press the down key
And the focused element is "Category 1" "list_item" in the "Move items" "dialogue"
And I press the down key
And the focused element is "Category 2" "list_item" in the "Move items" "dialogue"
And I press the down key
And the focused element is "Category 3" "list_item" in the "Move items" "dialogue"
And the "data-selected" attribute of "Category 3" "list_item" should contain "false"
# Select the grade category "Category 2".
And I press enter
And the "data-selected" attribute of "Category 3" "list_item" should contain "true"
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
And I press tab
And the focused element is "Cancel" "button" in the "Move items" "dialogue"
And I press tab
And the focused element is "Move" "button" in the "Move items" "dialogue"
When I press the enter key
And I wait until the page is ready
And I wait "2" seconds
And I press tab key in "region-main" "region"
# Confirm that 'Grade item 1' and 'Grade item 2' have been moved to 'Category 3'
And I click on grade item menu "Grade item 1" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I wait until "Edit grade item" "dialogue" exists
Then I should see "Category 3" in the "Grade category" "form_row"
And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
And I click on grade item menu "Grade item 2" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu
And I wait until "Edit grade item" "dialogue" exists
And I should see "Category 3" in the "Grade category" "form_row"
@@ -0,0 +1,27 @@
@core @core_grades @javascript
Feature: Configurable default grade export method
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario: View default grade export method in gradebook
Given I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "More > Export" in the course gradebook
Then I should see "Export to OpenDocument spreadsheet"
Scenario: Changing the default grade export method in gradebook
Given the following config values are set as admin:
| gradeexport_default | txt |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "More > Export" in the course gradebook
Then I should see "Export to Plain text file"
+64
View File
@@ -0,0 +1,64 @@
@gradereport @gradereport_grader @javascript
Feature: Display feedback on the Grader report
In order to check the expected results are displayed
As a teacher
I need to see the feedback information in a modal
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | course | name | assignfeedback_comments_enabled |
| assign | C1 | Test assignment name 1 | 1 |
| assign | C1 | Test assignment name 2 | 1 |
And the following "mod_assign > submissions" exist:
| assign | user | onlinetext |
| Test assignment name 1 | student1 | This is a submission for assignment 1 |
| Test assignment name 2 | student1 | This is a submission for assignment 2 |
And the following "grade items" exist:
| itemname | course | gradetype | itemtype |
| Grade item 1 | C1 | text | manual |
And the following "grade grades" exist:
| gradeitem | user | grade | feedback |
| Grade item 1 | student1 | | Longer feedback text content |
And I am on the "Test assignment name 1" "assign activity" page logged in as teacher1
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
| Grade out of 100 | 50 |
| Feedback comments | This is feedback |
And I press "Save changes"
Scenario: View the feedback icon on the Grader report
When I am on the "Course 1" "grades > Grader report > View" page
Then I should see "Test assignment name 1" in the "user-grades" "table"
And I should see "Test assignment name 2" in the "user-grades" "table"
And "Feedback provided" "icon" should exist in the "Student 1" "table_row"
And "Feedback provided" "icon" should not exist in the "Student 2" "table_row"
Scenario: View the feedback modal from the action menu
When I am on the "Course 1" "grades > Grader report > View" page
And I click on "Test assignment name 1" "core_grades > grade_actions" in the "Student 1" "table_row"
When I choose "View feedback" in the open action menu
Then I should see "This is feedback" in the "Test assignment name 1" "dialogue"
Scenario: View the feedback text for text only grade
When I am on the "Course 1" "grades > Grader report > View" page
Then I should see "Grade item 1"
And "Longer feedback ..." "text" should exist in the "Student 1" "table_row"
Scenario: View the feedback modal for text only grade
Given I am on the "Course 1" "grades > Grader report > View" page
When I click on "Longer feedback ..." "text" in the "Student 1" "table_row"
Then I should see "Longer feedback text content" in the "Grade item 1" "dialogue"
@@ -0,0 +1,68 @@
@core @core_grades @javascript
Feature: We can change the maximum and minimum number of points for manual items with existing grades
In order to verify existing grades are modified as expected
As an teacher
I need to modify a grade item with exiting grades
I need to ensure existing grades are modified in an expected manner
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Manual item 1 |
| Minimum grade | 0 |
| Maximum grade | 100 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
Scenario: Change maximum number of points on a graded item.
Given I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode on
And I give the grade "10.00" to the user "Student 1" for the grade item "Manual item 1"
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 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 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:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Manual item 1 | 100.00 % | 10.00 | 100.00 % |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| 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 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 |
And I click on "Save" "button" in the "Edit grade item" "dialogue"
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Manual item 1 | 100.00 % | 20.00 | 100.00 % |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Manual item 1 | 100.00 % | 16.00 | 80.00 % |
@@ -0,0 +1,64 @@
@core @core_grades @javascript
Feature: Student and teacher's view of aggregated grade items is consistent when hidden grade items are present
In order to calculate grade totals
As an teacher
I need to add aggregate columns to the gradebook
Scenario: Natural aggregation of course categories with hidden items calculates correctly for teacher and student
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "grade categories" exist:
| 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! | 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 am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | calculated |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I set "=[[a4]]/2" calculation for grade item "calculated" with idnumbers:
| 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
And I set the field "s__grade_report_user_showtotalsifcontainhidden" to "Show totals excluding hidden items"
And I press "Save changes"
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment three"
And I press "Save changes"
And I set the following settings for grade item "Test assignment four" of type "gradeitem" on "grader" page:
| Hidden | 1 |
And I am on the "Course 1" "grades > User report > View" page
And I click on "Student 1" in the "user" search widget
And I set the field "View report as" to "Myself"
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 100.00 % | 50.00 | 0100 | 50.00 % | 25.00 % |
| Test assignment two | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment three | 100.00 % | 50.00 | 0100 | 50.00 % | 25.00 % |
| Course total | - | 100.00 | 0200 | 50.00 % | - |
When I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 100.00 % | 50.00 | 0100 | 50.00 % | 25.00 % |
| Test assignment two | -( Empty ) | - | 0100 | - | - |
| Test assignment three | 100.00 % | 50.00 | 0100 | 50.00 % | 25.00 % |
| Course total | - | 100.00 | 0200 | 50.00 % | - |
And I should not see "Test assignment four" in the "user-grade" "table"
@@ -0,0 +1,78 @@
@core @core_grades @javascript
Feature: Hidden grade items should be hidden when grade category is locked, but should be visible in overridden category
In order to verify existing grades items display as expected
As an teacher
I need to modify grade items and grade categories
I need to ensure existing grades display in an expected manner
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I am on the "Course 1" "grades > gradebook setup" page logged in as "admin"
And I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Test locked category |
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Hidden item |
| Hidden | 1 |
| Grade category | Test locked category |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
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" of type "category" on "setup" page:
| Locked | 1 |
Scenario: Hidden grade items in locked category is hidden for teacher
Given I am on the "Course 1" "grades > User report > View" page logged in as teacher1
And I click on "Student 1" in the "user" search widget
When I set the field "View report as" to "Myself"
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test locked category total | 100.00 % | 50.00 | 0100 | 50.00 % | - |
| Course total | - | 50.00 | 0100 | 50.00 % | - |
Scenario: Hidden grade items in locked category is hidden for student
When I am on the "Course 1" "grades > User report > View" page logged in as student1
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test locked category total | 100.00 % | - | 0100 | - | - |
| Course total | - | - | 0100 | - | - |
And I should not see "Hidden item"
Scenario: Hidden grade items in overridden category should show
Given I am on the "Course 1" "grades > gradebook setup" page
And I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Test overridden category B|
And I click on "Save" "button" in the "New category" "dialogue"
And I wait until the page is ready
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Cat b item |
| Grade category | Test overridden category B |
And I click on "Save" "button" in the "New grade item" "dialogue"
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "50.00" to the user "Student 1" for the grade item "Test overridden category B total"
And I press "Save changes"
And I am on the "Course 1" "grades > User report > View" page logged in as "student1"
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test locked category total | 50.00 % | - | 0100 | - | - |
| Test overridden category B total | 50.00 % | 50.00 | 0100 | 50.00 % | - |
| Course total | - | - | 0200 | - | - |
+88
View File
@@ -0,0 +1,88 @@
@core @core_grades @javascript @_file_upload
Feature: An admin can import grades into gradebook using a CSV file
In order to import grades using a CSV file
As a teacher
I need to be able to upload a CSV file and see uploaded grades in gradebook
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And the following "grade item" exists:
| course | C1 |
| itemname | Manual item 1 |
| grademin | 10 |
| grademax | 500 |
And the following "grade grades" exist:
| gradeitem | user | grade |
| Manual item 1 | student1 | 50.00 |
| Manual item 1 | student2 | 50.00 |
| Manual item 1 | student3 | 50.00 |
Scenario: Max grade of grade item is respected when importing grades
Given I am on the "Course 1" "Course" page logged in as "teacher1"
And I navigate to "CSV file" import page in the course gradebook
And I upload "grade/tests/fixtures/grade_import_grademax.csv" file to "File" filemanager
And I click on "Upload grades" "button"
And I set the field "Map from" to "Email address"
And I set the field "Map to" to "Email address"
And I set the field "Manual item 1" to "Manual item 1"
And I click on "Upload grades" "button"
And I should see "One of the grade values is larger than the allowed grade maximum of 500.0"
And I should see "Import failed. No data was imported."
And I click on "Continue" "button"
And I upload "grade/tests/fixtures/grade_import_grademin.csv" file to "File" filemanager
And I click on "Upload grades" "button"
And I set the field "Map from" to "Email address"
And I set the field "Map to" to "Email address"
And I set the field "Manual item 1" to "Manual item 1"
And I click on "Upload grades" "button"
And I should see "One of the grade values is smaller than the allowed grade minimum of 10.0"
And I should see "Import failed. No data was imported."
And I click on "Continue" "button"
When I upload "grade/tests/fixtures/grade_import.csv" file to "File" filemanager
And I click on "Upload grades" "button"
And I set the field "Map from" to "Email address"
And I set the field "Map to" to "Email address"
And I set the field "Manual item 1" to "Manual item 1"
And I click on "Upload grades" "button"
And I should see "Grade import success"
And I click on "Continue" "button"
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Student 1 | student1@example.com | 400.00 | 400.00 |
| Student 2 | student2@example.com | 50.00 | 50.00 |
| Student 3 | student3@example.com | 50.00 | 50.00 |
Scenario: Importing grades with multiple new mappings
Given I am on the "Course 1" "Course" page logged in as "teacher1"
And I navigate to "CSV file" import page in the course gradebook
And I upload "grade/tests/fixtures/grade_import_multiple_mappings.csv" file to "File" filemanager
And I click on "Upload grades" "button"
And I set the following fields to these values:
| Map from | Email address |
| Map to | Email address |
| Grade A | New grade item |
| Grade B | New grade item |
| Grade C | New grade item |
| Grade D | New grade item |
And I click on "Upload grades" "button"
And I should see "Grade import success"
And I click on "Continue" "button"
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- | -5- | -6- | -7- | -8- |
| Student 1 | student1@example.com | 50.00 | 11.00 | 12.00 | 13.00 | 14.00 | 100.00 |
| Student 2 | student2@example.com | 50.00 | 21.00 | 22.00 | 23.00 | 24.00 | 140.00 |
| Student 3 | student3@example.com | 50.00 | 31.00 | 32.00 | 33.00 | 34.00 | 180.00 |
@@ -0,0 +1,45 @@
@core @core_grades @javascript
Feature: We can duplicate grade items that already exist.
In order to quickly create grade items that have similar settings.
As a teacher
I need to duplicate an existing grade item and check that its values are properly duplicated.
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "grade categories" exist:
| fullname | course |
| Category1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | gradecategory |
| assign | C1 | a1 | Assignment1 | Category1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "grade items" exist:
| itemname | course | category | idnumber | gradetype | grademax | grademin | gradepass | display | decimals | hidden | weightoverride |
| Item1 | C1 | Category1 | 001 | Value | 80.00 | 5.00 | 40.00 | 1 | 1 | 0 | 1 |
Scenario: Ensure the duplicated grade item settings match the original grade item
Given I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
And I should not see "Duplicate Category1"
And I should not see "Duplicate Assignment1"
When I duplicate the grade item "Item1"
Then I should see "Item1 (copy)"
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 I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the field "Item name" matches value "Item1 (copy)"
And the field "ID number" matches value ""
And the field "Grade type" matches value "Value"
And the field "Maximum grade" matches value "80.00"
And the field "Minimum grade" matches value "5.00"
And the field "Grade to pass" matches value "40.00"
And the field "Grade display type" matches value "Real"
And the field "Overall decimal places" matches value "1"
And the field "Hidden" matches value "0"
And the field "Weight adjusted" matches value "1"
@@ -0,0 +1,94 @@
@core @core_grades
Feature: Teacher can unhide grades on the edit page allowing students to view their grades
In order to show the grades of an activity to a student
As a teacher
I need to unhide an activity on the edit page
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | assignfeedback_comments_enabled |
| assign | C1 | assign1 | Test assignment name | Test assignment description | 1 |
And I am on the "Test assignment name" "assign activity" page logged in as teacher1
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the following fields to these values:
| Grade out of 100 | 50 |
| Feedback comments | I'm the teacher feedback |
And I press "Save changes"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
@javascript
Scenario: Hiding the activity using the drop-down hide link and then unhiding the activity using the edit settings form page
Given I hide the grade item "Test assignment name" of type "gradeitem" on "setup" page
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
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 click on "Save" "button" in the "Edit grade item" "dialogue"
And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
@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 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 click on "Save" "button" in the "Edit grade item" "dialogue"
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
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 am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
@javascript
Scenario: Hiding the category using the drop-down hide link and then unhiding the category using the edit settings form page
Given I hide the grade item "Course 1" of type "course" on "setup" page
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
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 click on "Save" "button" in the "Edit category" "dialogue"
And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
@javascript
Scenario: Hiding the category using the edit settings form page and then unhiding the category using the drop-down show link
Given I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Hidden | 1 |
And I am on the "Test assignment name" "assign activity" page logged in as student1
And I should not see "50.00"
And I should not see "I'm the teacher feedback"
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
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 am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00"
And I should see "I'm the teacher feedback" in the "Feedback comments" "table_row"
@@ -0,0 +1,135 @@
@core @core_grades @javascript @testtt
Feature: We carry over data from modal to advanced grade item settings
In order to setup grade items quickly
As an teacher
I need to ensure data is carried over from modal to advanced grade item settings
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "grade categories" exist:
| fullname | course |
| Some cool grade category | C1 |
And the following config values are set as admin:
| enableoutcomes | 1 |
And the following "scales" exist:
| name | scale |
| Test Scale | Disappointing, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Outcome 1 | OT1 | C1 | Test Scale |
| Outcome 2 | OT2 | C1 | Test Scale |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | a1 | Test assignment 1 | 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 |
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 choose the "Add grade item" item in the "Add" action menu
Scenario: Defaults are used when creating a new grade item
Given I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the following fields match these values:
| Item name | |
| Minimum grade | 0 |
| Maximum grade | 100 |
| Weight adjusted | 0 |
| aggregationcoef2 | 0 |
| Grade category | Course 1 |
And I press "Cancel"
And I wait until the page is ready
And I choose the "Add category" item in the "Add" action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the following fields match these values:
| Category name | |
| Aggregation | Natural |
| Weight adjusted | 0 |
| grade_item_aggregationcoef2 | 0 |
| Parent category | Course 1 |
And I press "Cancel"
And I wait until the page is ready
And I choose the "Add outcome item" item in the "Add" action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the following fields match these values:
| Item name | |
| Outcome | Outcome 1 |
| Linked activity | None |
| Grade category | Course 1 |
Scenario: We carry over data from modal to advanced grade item settings
Given I set the following fields to these values:
| Item name | Manual item 1 |
| Minimum grade | 1 |
| Maximum grade | 99 |
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
| Grade category | Some cool grade category |
When I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the following fields match these values:
| Item name | Manual item 1 |
| Minimum grade | 1 |
| Maximum grade | 99 |
| Weight adjusted | 1 |
| aggregationcoef2 | 100 |
| Grade category | Some cool grade category |
And I press "Cancel"
And I wait until the page is ready
And I choose the "Add category" item in the "Add" action menu
And I set the following fields to these values:
| Category name | Category 1 |
| Aggregation | Mean of grades |
| Minimum grade | 1 |
| Maximum grade | 99 |
| Weight adjusted | 1 |
| grade_item_aggregationcoef2 | 100 |
| Parent category | Some cool grade category |
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the following fields match these values:
| Category name | Category 1 |
| Aggregation | Mean of grades |
| Minimum grade | 1 |
| Maximum grade | 99 |
| Weight adjusted | 1 |
| grade_item_aggregationcoef2 | 100 |
| Parent category | Some cool grade category |
And I press "Cancel"
And I choose the "Add category" item in the "Add" action menu
# Confirm that the form values are carried over even if some mandatory fields are missing (e.g. Category name).
And I set the following fields to these values:
| Aggregation | Mean of grades |
| Minimum grade | 1 |
| Maximum grade | 99 |
| Weight adjusted | 1 |
| grade_item_aggregationcoef2 | 100 |
| Parent category | Some cool grade category |
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the following fields match these values:
| Category name | |
| Aggregation | Mean of grades |
| Minimum grade | 1 |
| Maximum grade | 99 |
| Weight adjusted | 1 |
| grade_item_aggregationcoef2 | 100 |
| Parent category | Some cool grade category |
And I press "Cancel"
And I wait until the page is ready
And I choose the "Add outcome item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | Outcome item 1 |
| Outcome | Outcome 2 |
| Linked activity | Test assignment 1 |
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the following fields match these values:
| Item name | Outcome item 1 |
| Outcome | Outcome 2 |
| Linked activity | Test assignment 1 |
@@ -0,0 +1,119 @@
@core_grades @javascript
Feature: Grade item validation
In order to ensure validation is provided to the teacher
As a teacher
I need to know why I can not add/edit values on the grade item form
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@example.com |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Category 1 | C1 |
And I log in as "admin"
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 | 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 | Letter scale |
| Scale | Disappointing, Good, Very good, Excellent |
And I press "Save changes"
And I am on the "Course 1" "grades > gradebook setup" page
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | MI 1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
Scenario: Being able to change the grade type, scale and maximum grade for a manual grade item when there are no grades
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 click on "Save" "button" in the "Edit grade item" "dialogue"
And I should see "Scale must be selected"
And I set the field "Scale" to "ABCDEF"
And I click on "Save" "button" in the "Edit grade item" "dialogue"
And I should not see "You cannot change the type, as grades already exist for this item"
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 "Letter scale"
And I click on "Save" "button" in the "Edit grade item" "dialogue"
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 "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
When 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 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 "ABCDEF"
And I click on "Save" "button" in the "Edit grade item" "dialogue"
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 "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
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 "MI 1"
And I press "Save changes"
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
When 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
Scenario: As a teacher confirm that I can delete items within the gradebook
Given I navigate to "Setup > Gradebook setup" in the course gradebook
And the following should exist in the "setup-grades" table:
| Name |
| Course |
| MI 1 |
| Category 1 |
| Course total |
And I click on grade item menu "MI 1" of type "gradeitem" on "setup" page
And I choose "Delete" in the open action menu
And "Confirm" "dialogue" should exist
When I click on "Delete" "button" in the "Confirm" "dialogue"
And I wait to be redirected
And the following should not exist in the "setup-grades" table:
| Name |
| MI 1 |
When I click on grade item menu "Category 1" of type "category" on "setup" page
And I choose "Delete" in the open action menu
And "Confirm" "dialogue" should exist
And I click on "Delete" "button" in the "Confirm" "dialogue"
And I wait to be redirected
And the following should not exist in the "setup-grades" table:
| Name |
| Category 1 |
@@ -0,0 +1,41 @@
@core @core_grades
Feature: We can customise the letter boundary of a course.
In order to change the letter boundary of a course
As a teacher
I need to add assessments to the gradebook.
@javascript
Scenario: I edit the letter boundaries of a course and grade a student.
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber | alternatename |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 | Terry |
| student1 | Student | 1 | student1@example.com | s1 | Sally |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 100 |
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
And I set the following fields to these values:
| Grade display type | Letter |
And I press "Save changes"
And I navigate to "More > Grade letters" in the course gradebook
And I click on "Edit" "button"
And I set the following fields to these values:
| Override site defaults | 1 |
| Letter grade boundary 10 | 57 |
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 "57" to the user "Student 1" for the grade item "Test assignment one"
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode off
And I navigate to "View > Grader report" in the course gradebook
Then the following should exist in the "user-grades" table:
| -1- | -2- |-3- | -4- |
| Student 1 | student1@example.com | D | D |
@@ -0,0 +1,42 @@
@core @core_grades
Feature: We can customise the letter boundary of a course in gradebook version 20160518.
In order to change the letter boundary of a course
As a teacher
I need to add assessments to the gradebook.
@javascript
Scenario: I edit the letter boundaries of a course and grade a student.
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And gradebook calculations for the course "C1" are frozen at version "20160518"
And the following "users" exist:
| username | firstname | lastname | email | idnumber | alternatename |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 | Terry |
| student1 | Student | 1 | student1@example.com | s1 | Sally |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 100 |
And I am on the "Course 1" "grades > course grade settings" page logged in as "teacher1"
And I set the following fields to these values:
| Grade display type | Letter |
And I press "Save changes"
And I navigate to "More > Grade letters" in the course gradebook
And I click on "Edit" "button"
And I set the following fields to these values:
| Override site defaults | 1 |
| Letter grade boundary 10 | 57 |
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 "57" to the user "Student 1" for the grade item "Test assignment one"
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode off
And I navigate to "View > Grader report" in the course gradebook
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Student 1 | student1@example.com | F | F |
@@ -0,0 +1,35 @@
@core @core_grades @javascript
Feature: We can view the logs for any changes to grade letters.
In order to view changes the letter boundary of a course
As an administrator
I need to add make changes and then view the logs.
Scenario: I override the letter boundaries and check the logs.
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I am on the "Course 1" "grades > course grade settings" page logged in as "admin"
And I set the following fields to these values:
| Grade display type | Letter |
And I press "Save changes"
And I navigate to "More > Grade letters" in the course gradebook
And I click on "Edit" "button"
And I set the following fields to these values:
| Override site defaults | 1 |
| Letter grade boundary 10 | 57 |
And I press "Save changes"
And I click on "Edit" "button"
And I set the following fields to these values:
| Override site defaults | 1 |
| Letter grade boundary 10 | 50 |
And I press "Save changes"
And I click on "Edit" "button"
And I set the following fields to these values:
| Override site defaults | 1 |
| Grade letter 11 | |
| Letter grade boundary 11 | |
And I press "Save changes"
When I navigate to "Reports > Live logs" in site administration
Then I should see "Grade letter created"
And I should see "Grade letter updated"
And I should see "Grade letter deleted"
+83
View File
@@ -0,0 +1,83 @@
@core @core_grades
Feature: We can use a minimum grade different than zero
In order to use a minimum grade different than zero
As an teacher
I need to set up a minimum grade different than zero
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "grade categories" exist:
| fullname | course | aggregateonlygraded |
| Sub category 1 | C1 | 0 |
| Sub category 2 | C1 | 0 |
And the following "grade items" exist:
| itemname | grademin | course |
| Manual item 1 | -100 | C1 |
| Manual item 2 | 50 | C1 |
And the following "grade items" exist:
| itemname | grademin | grademax | course | gradecategory |
| Manual item 3 | -100 | 50 | C1 | Sub category 1 |
And the following "grade items" exist:
| itemname | grademin | course | gradecategory |
| Manual item 4 | -100 | C1 | Sub category 1 |
| Manual item 5 | 50 | C1 | Sub category 2 |
| Manual item 6 | 50 | C1 | Sub category 2 |
And I log in as "admin"
And I am on the "Course 1" "grades > gradebook setup" page
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
@javascript
Scenario: Natural aggregation with negative and positive grade
Given I navigate to "Setup > Gradebook setup" in the course gradebook
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 am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
When I give the grade "-25.00" to the user "Student 1" for the grade item "Manual item 1"
And I give the grade "50.00" to the user "Student 1" for the grade item "Manual item 2"
And I give the grade "-80.00" to the user "Student 1" for the grade item "Manual item 3"
And I give the grade "-10.00" to the user "Student 1" for the grade item "Manual item 4"
And I give the grade "50.00" to the user "Student 1" for the grade item "Manual item 5"
And I give the grade "75.00" to the user "Student 1" for the grade item "Manual item 6"
And I give the grade "0.00" to the user "Student 2" for the grade item "Manual item 1"
And I give the grade "50.00" to the user "Student 2" for the grade item "Manual item 2"
And I give the grade "-10.00" to the user "Student 2" for the grade item "Manual item 3"
And I give the grade "50.00" to the user "Student 2" for the grade item "Manual item 4"
And I give the grade "50.00" to the user "Student 2" for the grade item "Manual item 5"
And I give the grade "50.00" to the user "Student 2" for the grade item "Manual item 6"
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:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Manual item 1 | 18.18 % | -25.00 | -4.55 % |
| Manual item 2 | 18.18 % | 50.00 | 9.09 % |
| Manual item 3 | 33.33 % | -80.00 | -14.55 % |
| Manual item 4 | 66.67 % | -10.00 | -1.82 % |
| Manual item 5 | 50.00 % | 50.00 | 9.09 % |
| Manual item 6 | 50.00 % | 75.00 | 13.64 % |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Contribution to course total |
| Manual item 1 | 18.18 % | 0.00 | 0.00 % |
| Manual item 2 | 18.18 % | 50.00 | 9.09 % |
| Manual item 3 | 33.33 % | -10.00 | -1.82 % |
| Manual item 4 | 66.67 % | 50.00 | 9.09 % |
| Manual item 5 | 50.00 % | 50.00 | 9.09 % |
| Manual item 6 | 50.00 % | 50.00 | 9.09 % |
+163
View File
@@ -0,0 +1,163 @@
@core @core_grades @javascript
Feature: We can choose what min or max grade to use when aggregating grades.
In order to what min or max grade to use
As an teacher
I can update modify a course setting
Scenario: Changing the min or max grade to use updates the grades accordingly
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| C1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| CAT1 | C1 |
And I log in as "admin"
And I set the following administration settings values:
| grade_minmaxtouse | Min and max grades as specified in grade item settings |
And I am on the "C1" "grades > gradebook setup" page
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | MI 1 |
| Grade category | C1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | MI 2 |
| Grade category | C1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | MI 3 |
| Grade category | CAT1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | MI 4 |
| Grade category | CAT1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I choose the "Add grade item" item in the "Add" action menu
And I set the following fields to these values:
| Item name | MI 5 |
| Grade category | C1 |
And I click on "Save" "button" in the "New grade item" "dialogue"
And I set "=[[mi1]]+[[mi2]]+[[mi3]]" calculation for grade item "MI 5" with idnumbers:
| MI 1 | mi1 |
| MI 2 | mi2 |
| MI 3 | mi3 |
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Min and max grades used in calculation" to "Default (Min and max grades as specified in grade item settings)"
And I set the field "Show weightings" to "Show"
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" of type "category" on "setup" page:
| Aggregation | Natural |
And I am on the "C1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "75.00" to the user "Student 1" for the grade item "MI 1"
And I give the grade "25.00" to the user "Student 1" for the grade item "MI 2"
And I give the grade "50.00" to the user "Student 1" for the grade item "MI 3"
And I give the grade "100.00" to the user "Student 1" for the grade item "MI 4"
And I give the grade "20.00" to the user "Student 2" for the grade item "MI 1"
And I give the grade "10.00" to the user "Student 2" for the grade item "MI 3"
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
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 1 | 20.00 % | 75.00 | 0100 | 75.00 % | 15.00 % |
| MI 2 | 20.00 % | 25.00 | 0100 | 25.00 % | 5.00 % |
| MI 3 | 50.00 % | 50.00 | 0100 | 50.00 % | 10.00 % |
| MI 4 | 50.00 % | 100.00 | 0100 | 100.00 % | 20.00 % |
| MI 5 | 20.00 % | 100.00 | 0100 | 100.00 % | 20.00 % |
| CAT1 total | 40.00 % | 150.00 | 0200 | 75.00 % | - |
| Course total | - | 350.00 | 0500 | 70.00 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 1 | 33.33 % | 20.00 | 0100 | 20.00 % | 6.67 % |
| MI 2 | 0.00 % | - | 0100 | - | 0.00 % |
| MI 3 | 100.00 % | 10.00 | 0100 | 10.00 % | 3.33 % |
| MI 4 | 0.00 % | - | 0100 | - | 0.00 % |
| MI 5 | 33.33 % | 30.00 | 0100 | 30.00 % | 10.00 % |
| CAT1 total | 33.33 % | 10.00 | 0100 | 10.00 % | - |
| Course total | - | 60.00 | 0300 | 20.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
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" of type "gradeitem" on "setup" page:
| Rescale existing grades | No |
| Maximum grade | 50.00 |
| Minimum grade | 5.00 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 1 | 12.50 % | 75.00 | 550 | 100.00 % | 18.75 % |
| MI 2 | 25.00 % | 25.00 | 0100 | 25.00 % | 6.25 % |
| MI 3 | 33.33 % | 50.00 | 550 | 100.00 % | 12.50 % |
| MI 4 | 66.67 % | 100.00 | 0100 | 100.00 % | 25.00 % |
| MI 5 | 25.00 % | 100.00 | 0100 | 100.00 % | 25.00 % |
| CAT1 total | 37.50 % | 150.00 | 0150 | 100.00 % | - |
| Course total | - | 350.00 | 0400 | 87.50 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 1 | 25.00 % | 20.00 | 550 | 33.33 % | 10.00 % |
| MI 2 | 0.00 % | - | 0100 | - | 0.00 % |
| MI 3 | 100.00 % | 10.00 | 550 | 11.11 % | 5.00 % |
| MI 4 | 0.00 % | - | 0100 | - | 0.00 % |
| MI 5 | 50.00 % | 30.00 | 0100 | 30.00 % | 15.00 % |
| CAT1 total | 25.00 % | 10.00 | 050 | 20.00 % | - |
| Course total | - | 60.00 | 0200 | 30.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
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
And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 5 | 40.00 % | 150.00 | 0200 | 75.00 % | 30.00 % |
| Course total | - | 400.00 | 0500 | 80.00 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 5 | 66.67 % | 30.00 | 0200 | 15.00 % | 10.00 % |
| Course total | - | 60.00 | 0300 | 20.00 % | - |
And I navigate to "Setup > Course grade settings" in the course gradebook
When I set the field "Min and max grades used in calculation" to "Initial min and max grades"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 1 | 16.67 % | 75.00 | 0100 | 75.00 % | 12.50 % |
| MI 2 | 16.67 % | 25.00 | 0100 | 25.00 % | 4.17 % |
| MI 3 | 50.00 % | 50.00 | 0100 | 50.00 % | 8.33 % |
| MI 4 | 50.00 % | 100.00 | 0100 | 100.00 % | 16.67 % |
| MI 5 | 33.33 % | 150.00 | 0200 | 75.00 % | 25.00 % |
| CAT1 total | 33.33 % | 150.00 | 0200 | 75.00 % | - |
| Course total | - | 400.00 | 0600 | 66.67 % | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| MI 1 | 25.00 % | 20.00 | 0100 | 20.00 % | 5.00 % |
| MI 2 | 0.00 % | - | 0100 | - | 0.00 % |
| MI 3 | 100.00 % | 10.00 | 0100 | 10.00 % | 2.50 % |
| MI 4 | 0.00 % | - | 0100 | - | 0.00 % |
| MI 5 | 50.00 % | 30.00 | 0200 | 15.00 % | 7.50 % |
| CAT1 total | 25.00 % | 10.00 | 0100 | 10.00 % | - |
| Course total | - | 60.00 | 0400 | 15.00 % | - |
@@ -0,0 +1,267 @@
@core @core_grades
Feature: Weights in natural aggregation are adjusted if the items are excluded from user report
In order to correctly display user report
As a teacher
I need to be able to exclude hidden grades.
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | x | 100 |
| assign | C1 | a2 | Test assignment two | x | 50 |
| assign | C1 | a3 | Test assignment three | x | 200 |
| assign | C1 | a4 | Test assignment four (extra) | x | 20 |
| assign | C1 | a5 | Test assignment five (extra) | x | 10 |
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
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)" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
@javascript
Scenario: No weights are overridden and student has all grades present
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "150.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 (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 28.57 % | 80.00 | 0100 | 80.00 % | 22.86 % |
| Test assignment two | 14.29 % | 30.00 | 050 | 60.00 % | 8.57 % |
| Test assignment three | 57.14 % | 150.00 | 0200 | 75.00 % | 42.86 % |
| Test assignment four (extra) | 5.71 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.86 % |
| Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
| Course total | - | 278.00 | 0350 | 79.43 % | - |
And I log out
@javascript
Scenario: No weights are overridden, student has some grades present
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 66.67 % | 80.00 | 0100 | 80.00 % | 53.33 % |
| Test assignment two | 33.33 % | 30.00 | 050 | 60.00 % | 20.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00 | 020 | 50.00 % | 6.67 % |
| Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
| Course total | - | 128.00 | 0150 | 85.33 % | - |
And I log out
@javascript
Scenario: No weights are overridden, student has none grades present except for extra credit
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.00 | 00 | | - |
And I log out
@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" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
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" 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
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Extra credit ) | 80.00 | 0100 | 80.00 % | 0.00 % |
| Test assignment two | 0.00 %( Extra credit ) | 30.00 | 050 | 60.00 % | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.0 | 00 | | - |
And I log out
@javascript
Scenario: Weights are overridden and student has all grades present
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
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 "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "150.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 (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
| Test assignment two | 10.00 % | 30.00 | 050 | 60.00 % | 6.00 % |
| Test assignment three | 40.00 % | 150.00 | 0200 | 75.00 % | 30.00 % |
| Test assignment four (extra) | 5.71 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.86 % |
| Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
| Course total | - | 284.00 | 0350 | 81.14 % | - |
And I log out
@javascript
Scenario: Weights are overridden and student has some grades present
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
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 "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
| Test assignment two | 16.67 % | 30.00 | 050 | 60.00 % | 10.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00 | 020 | 50.00 % | 6.67 % |
| Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
| Course total | - | 133.00 | 0150 | 88.67 % | - |
And I log out
@javascript
Scenario: Weights are overridden, student has none grades present except for extra credit
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
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 "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.00 | 00 | | - |
And I log out
@javascript
Scenario: Weights are overridden, including extra credit, and student has all grades present
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I set the field "Override weight of Test assignment four (extra)" to "1"
And I set the field "Weight of Test assignment four (extra)" to "10"
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 "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "150.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 (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
| Test assignment two | 10.00 % | 30.00 | 050 | 60.00 % | 6.00 % |
| Test assignment three | 40.00 % | 150.00 | 0200 | 75.00 % | 30.00 % |
| Test assignment four (extra) | 10.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 5.00 % |
| Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
| Course total | - | 291.50 | 0350 | 83.29 % | - |
And I log out
@javascript
Scenario: Weights are overridden, including extra credit, and student has some grades present
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I set the field "Override weight of Test assignment four (extra)" to "1"
And I set the field "Weight of Test assignment four (extra)" to "10"
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 "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
| Test assignment two | 16.67 % | 30.00 | 050 | 60.00 % | 10.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 16.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 8.33 % |
| Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
| Course total | - | 135.50 | 0150 | 90.33 % | - |
And I log out
@javascript
Scenario: Weights are overridden, including extra credit, student has none grades present except for extra credit
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I set the field "Override weight of Test assignment four (extra)" to "1"
And I set the field "Weight of Test assignment four (extra)" to "10"
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 "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.00 | 00 | | - |
And I log out
@@ -0,0 +1,272 @@
@core @core_grades
Feature: Gradebook calculations for extra credit items before the fix 20150619
In order to make sure the grades are not changed after upgrade
As a teacher
I need to be able to freeze gradebook calculations
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And gradebook calculations for the course "C1" are frozen at version "20150619"
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | x | 100 |
| assign | C1 | a2 | Test assignment two | x | 50 |
| assign | C1 | a3 | Test assignment three | x | 200 |
| assign | C1 | a4 | Test assignment four (extra) | x | 20 |
| assign | C1 | a5 | Test assignment five (extra) | x | 10 |
And I am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
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)" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
@javascript
Scenario: No weights are overridden and student has all grades present (before the fix 20150619)
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "150.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 (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 28.57 % | 80.00 | 0100 | 80.00 % | 22.86 % |
| Test assignment two | 14.29 % | 30.00 | 050 | 60.00 % | 8.57 % |
| Test assignment three | 57.14 % | 150.00 | 0200 | 75.00 % | 42.86 % |
| Test assignment four (extra) | 5.71 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.86 % |
| Test assignment five (extra) | 2.86 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.29 % |
| Course total | - | 278.00 | 0350 | 79.43 % | - |
And I log out
@javascript
Scenario: No weights are overridden, student has some grades present (before the fix 20150619)
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 66.67 % | 80.00 | 0100 | 80.00 % | 53.33 % |
| Test assignment two | 33.33 % | 30.00 | 050 | 60.00 % | 20.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 13.33 %( Extra credit ) | 10.00 | 020 | 50.00 % | 6.67 % |
| Test assignment five (extra) | 6.67 %( Extra credit ) | 8.00 | 010 | 80.00 % | 5.33 % |
| Course total | - | 128.00 | 0150 | 85.33 % | - |
And I log out
@javascript
Scenario: No weights are overridden, student has none grades present except for extra credit (before the fix 20150619)
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.00 | 00 | | - |
And I log out
@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" of type "gradeitem" on "setup" page:
| Extra credit | 1 |
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" 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
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Extra credit ) | 80.00 | 0100 | 80.00 % | 0.00 % |
| Test assignment two | 0.00 %( Extra credit ) | 30.00 | 050 | 60.00 % | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.0 | 00 | | - |
And I log out
@javascript
Scenario: Weights are overridden and student has all grades present (before the fix 20150619)
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I press "Save changes"
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "150.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 (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
| Test assignment two | 10.00 % | 30.00 | 050 | 60.00 % | 6.00 % |
| Test assignment three | 40.00 % | 150.00 | 0200 | 75.00 % | 30.00 % |
| Test assignment four (extra) | 4.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 2.00 % |
| Test assignment five (extra) | 2.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 1.60 % |
| Course total | - | 278.60 | 0350 | 79.60 % | - |
# Contributions of extra credit "four" should be 20/350=5.71% and "five" 10/350=2.86% (350 is max grade for the course, 20 and 10 are max grades of "four" and "five")
And I log out
@javascript
Scenario: Weights are overridden and student has some grades present (before the fix 20150619)
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I press "Save changes"
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
| Test assignment two | 16.67 % | 30.00 | 050 | 60.00 % | 10.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 6.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 3.33 % |
| Test assignment five (extra) | 3.33 %( Extra credit ) | 8.00 | 010 | 80.00 % | 2.67 % |
| Course total | - | 124.00 | 0150 | 82.67 % | - |
# Contributions of extra credit "four" should be 20/150=13.33% and "five" 10/150=6.67% (150 is max grade for the course, 20 and 10 are max grades of "four" and "five")
And I log out
@javascript
Scenario: Weights are overridden, student has none grades present except for extra credit (before the fix 20150619)
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I press "Save changes"
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.00 | 00 | | - |
And I log out
@javascript
Scenario: Weights are overridden, including extra credit, and student has all grades present (before the fix 20150619)
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I set the field "Override weight of Test assignment four (extra)" to "1"
And I set the field "Weight of Test assignment four (extra)" to "10"
And I press "Save changes"
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "150.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 (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 50.00 % | 80.00 | 0100 | 80.00 % | 40.00 % |
| Test assignment two | 8.70 % | 30.00 | 050 | 60.00 % | 5.22 % |
| Test assignment three | 34.78 % | 150.00 | 0200 | 75.00 % | 26.09 % |
| Test assignment four (extra) | 10.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 5.00 % |
| Test assignment five (extra) | 1.74 %( Extra credit ) | 8.00 | 010 | 80.00 % | 1.39 % |
| Course total | - | 271.93 | 0350 | 77.70 % | - |
# Which is absolutely terrible because weights of normal items do not add up to 100%
And I log out
@javascript
Scenario: Weights are overridden, including extra credit, and student has some grades present (before the fix 20150619)
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I set the field "Override weight of Test assignment four (extra)" to "1"
And I set the field "Weight of Test assignment four (extra)" to "10"
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 "80.00" to the user "Student 1" for the grade item "Test assignment one"
And I give the grade "30.00" to the user "Student 1" for the grade item "Test assignment two"
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 83.33 % | 80.00 | 0100 | 80.00 % | 66.67 % |
| Test assignment two | 0.00 % | 30.00 | 050 | 60.00 % | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 16.67 %( Extra credit ) | 10.00 | 020 | 50.00 % | 8.33 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 112.50 | 0150 | 75.00 % | - |
# This is just ridiculous, the grades for "two" and "five" are 0 without any reason, and sum weight of normal items is not 100% again.
And I log out
@javascript
Scenario: Weights are overridden, including extra credit, student has none grades present except for extra credit (before the fix 20150619)
When I set the field "Override weight of Test assignment one" to "1"
And I set the field "Weight of Test assignment one" to "50"
And I set the field "Override weight of Test assignment four (extra)" to "1"
And I set the field "Weight of Test assignment four (extra)" to "10"
And I press "Save changes"
When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
And I give the grade "10.00" to the user "Student 1" for the grade item "Test assignment four (extra)"
And I give the grade "8.00" to the user "Student 1" for the grade item "Test assignment five (extra)"
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:
| Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | 0.00 %( Empty ) | - | 0100 | - | 0.00 % |
| Test assignment two | 0.00 %( Empty ) | - | 050 | - | 0.00 % |
| Test assignment three | 0.00 %( Empty ) | - | 0200 | - | 0.00 % |
| Test assignment four (extra) | 0.00 %( Extra credit ) | 10.00 | 020 | 50.00 % | 0.00 % |
| Test assignment five (extra) | 0.00 %( Extra credit ) | 8.00 | 010 | 80.00 % | 0.00 % |
| Course total | - | 0.00 | 00 | | - |
And I log out
@@ -0,0 +1,260 @@
@core @core_grades
Feature: We can use natural aggregation and weights will be normalised to a total of one hundred
In order to override weights
As a teacher
I need to add assessments to the gradebook.
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Sub category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 300 |
| assign | C1 | a2 | Test assignment two | Submit something! | 100 |
| assign | C1 | a3 | Test assignment three | Submit something! | 150 |
| 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! | 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 am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
@javascript
Scenario: Setting all weights in a category to exactly one hundred in total.
And the field "Weight of Test assignment five" matches value "44.444"
And the field "Weight of Test assignment six" matches value "22.222"
And the field "Weight of Test assignment seven" matches value "33.333"
When 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 "Override weight of Test assignment seven" to "1"
And I set the field "Weight of Test assignment five" to "30"
And I set the field "Weight of Test assignment six" to "50"
And I set the field "Weight of Test assignment seven" to "20"
And I press "Save changes"
Then I should not see "Your weights have been adjusted to total 100."
And the field "Weight of Test assignment five" matches value "30.0"
And the field "Weight of Test assignment six" matches value "50.0"
And the field "Weight of Test assignment seven" matches value "20.0"
@javascript
Scenario: Setting all weights in a category to less than one hundred is prevented.
When 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 "Override weight of Test assignment seven" to "1"
And I set the field "Weight of Test assignment five" to "1"
And I set the field "Weight of Test assignment six" to "1"
And I set the field "Weight of Test assignment seven" to "2"
Then I should see "Weight total is less than 100%." in the "Test assignment five" "table_row"
And I should see "Weight total is less than 100%." in the "Test assignment six" "table_row"
And I should see "Weight total is less than 100%." in the "Test assignment seven" "table_row"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
@javascript
Scenario: Set one of the grade item weights to a figure over one hundred is prevented.
When I set the field "Override weight of Test assignment five" to "1"
And I set the field "Weight of Test assignment five" to "120"
Then I should see "Weight total exceeds 100%." in the "Test assignment five" "table_row"
And the field "Weight of Test assignment five" matches value "120.0"
And the field "Weight of Test assignment six" matches value "0.0"
And the field "Weight of Test assignment seven" matches value "0.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
@javascript
Scenario: Setting several but not all grade item weights to over one hundred each is prevented.
When 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 "150"
And I set the field "Weight of Test assignment six" to "150"
Then I should see "Weight total exceeds 100%." in the "Test assignment five" "table_row"
And I should see "Weight total exceeds 100%." in the "Test assignment six" "table_row"
And the field "Weight of Test assignment five" matches value "150.0"
And the field "Weight of Test assignment six" matches value "150.0"
And the field "Weight of Test assignment seven" matches value "0.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
@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" 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"
And the field "Weight of Test assignment seven" matches value "50.0"
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 "60"
And I set the field "Weight of Test assignment six" to "40"
And I press "Save changes"
Then I should not see "Your weights have been adjusted to total 100."
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 "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"
@javascript
Scenario: Setting grade items weights is prevented 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" 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"
And I set the field "Weight of Test assignment five" to "60"
And I set the field "Weight of Test assignment six" to "50"
Then I should see "Weight total exceeds 100%." in the "Test assignment five" "table_row"
And I should see "Weight total exceeds 100%." in the "Test assignment six" "table_row"
And the field "Weight of Test assignment five" matches value "60.0"
And the field "Weight of Test assignment six" matches value "50.0"
And the field "Weight of Test assignment seven" matches value "50.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
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"
@javascript
Scenario: Setting grade items weights is prevented 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" 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"
And I set the field "Weight of Test assignment five" to "40"
And I set the field "Weight of Test assignment six" to "30"
Then I should see "Weight total is less than 100%." in the "Test assignment five" "table_row"
And I should see "Weight total is less than 100%." in the "Test assignment six" "table_row"
And the field "Weight of Test assignment five" matches value "40.0"
And the field "Weight of Test assignment six" matches value "30.0"
And the field "Weight of Test assignment seven" matches value "50.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
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"
@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" 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"
And I press "Save changes"
Then I should see "Your weights have been adjusted to total 100."
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 "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"
@javascript
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" 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"
Then I should not see "Your weights have been adjusted to total 100."
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" of type "gradeitem" on "setup" page:
| Extra credit | 0 |
And I should see "Your weights have been adjusted to total 100."
And the field "Weight of Test assignment five" matches value "0.0"
And the field "Weight of Test assignment six" matches value "0.0"
And the field "Weight of Test assignment seven" matches value "100.0"
@javascript
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" 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 "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"
@javascript
Scenario: Two out of three grade items weights are overridden and one is not. The overridden grade item weights total over one hundred.
Given 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 "65"
Then I should not see "Weight total exceeds 100%." in the "Test assignment five" "table_row"
And I should see "Weight total exceeds 100%." in the "Test assignment six" "table_row"
And I should see "Weight total exceeds 100%." in the "Test assignment seven" "table_row"
And the field "Weight of Test assignment five" matches value "0.0"
And the field "Weight of Test assignment six" matches value "55.0"
And the field "Weight of Test assignment seven" matches value "65.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
@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" 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 "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"
@javascript
Scenario: Overriding a grade item with a negative value results in the value being changed to zero.
When I set the field "Override weight of Test assignment five" to "1"
And I set the field "Weight of Test assignment five" to "-15"
Then the field "Weight of Test assignment five" matches value "0.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"
And I press "Save changes"
Then the field "Weight of Test assignment five" matches value "0.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"
And I set the field "Override weight of Test assignment six" to "1"
And I set the field "Weight of Test assignment six" to "-25"
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 "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"
And I set the field "Weight of Test assignment six" to "120"
And I should see "Weight total exceeds 100%." in the "Test assignment five" "table_row"
And I should see "Weight total exceeds 100%." in the "Test assignment six" "table_row"
And the field "Weight of Test assignment five" matches value "0.0"
And the field "Weight of Test assignment six" matches value "120.0"
And the field "Weight of Test assignment seven" matches value "0.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
@@ -0,0 +1,118 @@
@core @core_grades
Feature: Gradebook calculations for natural weights normalisation before the fix 20150619
In order to make sure the grades are not changed after upgrade
As a teacher
I need to be able to freeze gradebook calculations
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And gradebook calculations for the course "C1" are frozen at version "20150619"
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Sub category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | grade |
| assign | C1 | a1 | Test assignment one | Submit something! | 300 |
| assign | C1 | a2 | Test assignment two | Submit something! | 100 |
| assign | C1 | a3 | Test assignment three | Submit something! | 150 |
| 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! | 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 am on the "Course 1" "grades > gradebook setup" page logged in as "teacher1"
@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" 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"
And the field "Weight of Test assignment seven" matches value "50.0"
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 "60"
And I set the field "Weight of Test assignment six" to "40"
And I press "Save changes"
Then I should see "Your weights have been adjusted to total 100."
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 "0.0"
# The weight of "seven" should be 15/30=50% (15 is the maxgrade for "seven" and 30 are max grades for this category (max grade of "five" plus max grade of "six")
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"
@javascript
Scenario: Setting grade items weights is prevented 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" 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"
And I set the field "Weight of Test assignment five" to "60"
And I set the field "Weight of Test assignment six" to "50"
Then I should see "Weight total exceeds 100%." in the "Test assignment five" "table_row"
And I should see "Weight total exceeds 100%." in the "Test assignment six" "table_row"
And the field "Weight of Test assignment five" matches value "60.0"
And the field "Weight of Test assignment six" matches value "50.0"
And the field "Weight of Test assignment seven" matches value "0.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
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"
# The weight of "seven" should be 15/30=50% (15 is the maxgrade for "seven" and 30 are max grades for this category (max grade of "five" plus max grade of "six")
And the field "Weight of Test assignment seven" matches value "50.0"
@javascript
Scenario: Setting grade items weights is prevented 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" 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"
And I set the field "Weight of Test assignment five" to "40"
And I set the field "Weight of Test assignment six" to "30"
Then I should see "Weight total is less than 100%." in the "Test assignment five" "table_row"
And I should see "Weight total is less than 100%." in the "Test assignment six" "table_row"
And the field "Weight of Test assignment five" matches value "40.0"
And the field "Weight of Test assignment six" matches value "30.0"
And the field "Weight of Test assignment seven" matches value "0.0"
And I start watching to see if a new page loads
And I press "Save changes"
And a new page should not have loaded since I started watching
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"
# The weight of "seven" should be 15/30=50% (15 is the maxgrade for "seven" and 30 are max grades for this category (max grade of "five" plus max grade of "six")
And the field "Weight of Test assignment seven" matches value "50.0"
@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" 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"
And I press "Save changes"
Then I should see "Your weights have been adjusted to total 100."
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 "90.0"
# The weight of "seven" should be 15/30=50% (15 is the maxgrade for "seven" and 30 are max grades for this category (max grade of "five" plus max grade of "six")
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"
@@ -0,0 +1,260 @@
@core @core_grades @javascript
Feature: Grade letters can be overridden
In order to test the grade letters functionality
As a teacher I override site defaults
and alter the grade letters/edit/letter/index.php
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I navigate to "More > Grade letters" in the course gradebook
And I click on "Edit" "button"
Scenario Outline: Grade letters can be completely overridden
When I set the following fields to these values:
| Override site defaults | 1 |
| Grade letter 1 | <l1> |
| Letter grade boundary 1| <b1> |
| Grade letter 2 | <l2> |
| Letter grade boundary 2| <b2> |
| Grade letter 3 | <l3> |
| Letter grade boundary 3| <b3> |
| Grade letter 4 | <l4> |
| Letter grade boundary 4| <b4> |
| Grade letter 5 | <l5> |
| Letter grade boundary 5| <b5> |
| Grade letter 6 | <l6> |
| Letter grade boundary 6| <b6> |
| Grade letter 7 | <l7> |
| Letter grade boundary 7| <b7> |
| Grade letter 8 | <l8> |
| Letter grade boundary 8| <b8> |
| Grade letter 9 | <l9> |
| Letter grade boundary 9| <b9> |
| Grade letter 10 | |
| Letter grade boundary 10| |
| Grade letter 11 | |
| Letter grade boundary 11| |
And I press "Save changes"
Then I should see "The default grade letters are currently overridden."
And the following should exist in the "grade-letters-view" table:
| Highest | Lowest | Letter |
| <high1> | <low1> | <letter1> |
| <high2> | <low2> | <letter2> |
| <high3> | <low3> | <letter3> |
| <high4> | <low4> | <letter4> |
| <high5> | <low5> | <letter5> |
| <high6> | <low6> | <letter6> |
Examples:
| l1 | b1 | l2 | b2 | l3 | b3 | l4 | b4 | l5 | b5 | l6 | b6 | l7 | b7 | l8 | b8 | l9 | b9 | high1 | low1 | letter1 | high2 | low2 | letter2 | high3 | low3 | letter3 | high4 | low4 | letter4 | high5 | low5 | letter5 | high6 | low6 | letter6 |
| Z | 95 | Y | 85 | X | 75 | W | 65 | V | 55 | U | 45 | | | | | | | 100.00 % | 95.00 % | Z | 94.99 % | 85.00 % | Y | 84.99 % | 75.00 % | X | 74.99 % | 65.00 % | W | 64.99 % | 55.00 % | V | 54.99 % | 45.00 % | U |
| 5 | 100 | 4 | 80 | 3 | 60 | 2 | 40 | 1 | 20 | 0 | 0 | | | | | | | 100.00 % | 100.00 % | 5 | 99.99 % | 80.00 % | 4 | 79.99 % | 60.00 % | 3 | 59.99 % | 40.00 % | 2 | 39.99 % | 20.00 % | 1 | 19.99 % | 0.00 % | 0 |
| A | 95.25 | B | 76.75 | C | 50.01 | D | 40 | F | 0.01 | F- | 0 | | | | | | | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
| | | | | | | A | 95.25 | B | 76.75 | C | 50.01 | D | 40 | F | 0.01 | F- | 0 | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
| | | A | 95.25 | B | 76.75 | C | 50.01 | | | | | D | 40 | F | 0.01 | F- | 0 | 100.00 % | 95.25 % | A | 95.24 % | 76.75 % | B | 76.74 % | 50.01 % | C | 50.00 % | 40.00 % | D | 39.99 % | 0.01 % | F | 0.00 % | 0.00 % | F- |
Scenario Outline: Define grade letters with custom decimal separator
Given the following "language customisations" exist:
| component | stringid | value |
| core_langconfig | decsep | <decsep> |
When I set the following fields to these values:
| Override site defaults | 1 |
| Grade letter 1 | <l1> |
| Letter grade boundary 1| <b1> |
| Grade letter 2 | <l2> |
| Letter grade boundary 2| <b2> |
| Grade letter 3 | <l3> |
| Letter grade boundary 3| <b3> |
| Grade letter 4 | |
| Letter grade boundary 4| |
| Grade letter 5 | |
| Letter grade boundary 5| |
| Grade letter 6 | |
| Letter grade boundary 6| |
| Grade letter 7 | |
| Letter grade boundary 7| |
| Grade letter 8 | |
| Letter grade boundary 8| |
| Grade letter 9 | |
| Letter grade boundary 9| |
| Grade letter 10 | |
| Letter grade boundary 10| |
| Grade letter 11 | |
| Letter grade boundary 11| |
And I press "Save changes"
Then I should see "The default grade letters are currently overridden."
And the following should exist in the "grade-letters-view" table:
| Highest | Lowest | Letter |
| <high1> | <low1> | <l1> |
| <high2> | <low2> | <l2> |
| <high3> | <low3> | <l3> |
Examples:
| decsep | l1 | b1 | l2 | b2 | l3 | b3 | high1 | low1 | high2 | low2 | high3 | low3 |
| . | A | 88.88 | B | 50.00 | C | 0.00 | 100.00 % | 88.88 % | 88.87 % | 50.00 % | 49.99 % | 0.00 % |
| # | A | 88#88 | B | 50#00 | C | 0#00 | 100#00 % | 88#88 % | 88#87 % | 50#00 % | 49#99 % | 0#00 % |
Scenario: Define additional grade letters
Given I set the field "Override site defaults" to "1"
When I press "Add 3 field(s) to form"
And I set the following fields to these values:
| Grade letter 11 | E |
| Letter grade boundary 11 | 50 |
| Grade letter 12 | F |
| Letter grade boundary 12 | 40 |
| Grade letter 13 | G |
| Letter grade boundary 13 | 30 |
| Grade letter 14 | U |
| Letter grade boundary 14 | 0 |
And I press "Save changes"
Then I should see "The default grade letters are currently overridden."
And the following should exist in the "grade-letters-view" table:
| Highest | Lowest | Letter |
| 100.00 % | 93.00 % | A |
| 92.99 % | 90.00 % | A- |
| 89.99 % | 87.00 % | B+ |
| 86.99 % | 83.00 % | B |
| 82.99 % | 80.00 % | B- |
| 79.99 % | 77.00 % | C+ |
| 76.99 % | 73.00 % | C |
| 72.99 % | 70.00 % | C- |
| 69.99 % | 67.00 % | D+ |
| 66.99 % | 60.00 % | D |
| 59.99 % | 50.00 % | E |
| 49.99 % | 40.00 % | F |
| 39.99 % | 30.00 % | G |
| 29.99 % | 0.00 % | U |
Scenario: I delete a grade letter
Given I set the following fields to these values:
| Override site defaults | 1 |
| Grade letter 1 | A |
| Letter grade boundary 1| 90 |
| Grade letter 2 | B |
| Letter grade boundary 2| 80 |
| Grade letter 3 | C |
| Letter grade boundary 3| 50 |
| Grade letter 4 | D |
| Letter grade boundary 4| 40 |
| Grade letter 5 | E |
| Letter grade boundary 5| 20 |
| Grade letter 6 | F |
| Letter grade boundary 6| 0 |
| Grade letter 7 | |
| Letter grade boundary 7| |
| Grade letter 8 | |
| Letter grade boundary 8| |
| Grade letter 9 | |
| Letter grade boundary 9| |
| Grade letter 10 | |
| Letter grade boundary 10| |
| Grade letter 11 | |
| Letter grade boundary 11| |
And I press "Save changes"
And I should see "The default grade letters are currently overridden."
And the following should exist in the "grade-letters-view" table:
| Highest | Lowest | Letter |
| 100.00 % | 90.00 % | A |
| 89.99 % | 80.00 % | B |
| 79.99 % | 50.00 % | C |
| 49.99 % | 40.00 % | D |
| 39.99 % | 20.00 % | E |
| 19.99 % | 0.00 % | F |
When I click on "Edit" "button"
And I set the following fields to these values:
| Override site defaults | 1 |
| Grade letter 1 | A |
| Letter grade boundary 1| 90 |
| Grade letter 2 | B |
| Letter grade boundary 2| 80 |
| Grade letter 3 | C |
| Letter grade boundary 3| 50 |
| Grade letter 4 | D |
| Letter grade boundary 4| 40 |
| Grade letter 5 | |
| Letter grade boundary 5| |
| Grade letter 6 | F |
| Letter grade boundary 6| 0 |
And I press "Save changes"
Then I should see "The default grade letters are currently overridden."
And the following should exist in the "grade-letters-view" table:
| Highest | Lowest | Letter |
| 100.00 % | 90.00 % | A |
| 89.99 % | 80.00 % | B |
| 79.99 % | 50.00 % | C |
| 49.99 % | 40.00 % | D |
| 39.99 % | 0.00 % | F |
Scenario: I override grade letters for a second time
Given I set the following fields to these values:
| Override site defaults | 1 |
| Grade letter 1 | A+ |
| Letter grade boundary 1| 90 |
| Grade letter 2 | A |
| Letter grade boundary 2| 80 |
| Grade letter 3 | B+ |
| Letter grade boundary 3| 70 |
| Grade letter 4 | B |
| Letter grade boundary 4| 60 |
| Grade letter 5 | C |
| Letter grade boundary 5| 50 |
| Grade letter 6 | D |
| Letter grade boundary 6| 40 |
| Grade letter 7 | F |
| Letter grade boundary 7| 0 |
| Grade letter 8 | |
| Letter grade boundary 8| |
| Grade letter 9 | |
| Letter grade boundary 9| |
| Grade letter 10 | |
| Letter grade boundary 10| |
| Grade letter 11 | |
| Letter grade boundary 11| |
And I press "Save changes"
And I should see "The default grade letters are currently overridden."
And the following should exist in the "grade-letters-view" table:
| Highest | Lowest | Letter |
| 100.00 % | 90.00 % | A+ |
| 89.99 % | 80.00 % | A |
| 79.99 % | 70.00 % | B+ |
| 69.99 % | 60.00 % | B |
| 59.99 % | 50.00 % | C |
| 49.99 % | 40.00 % | D |
| 39.99 % | 0.00 % | F |
When I click on "Edit" "button"
And I set the following fields to these values:
| Override site defaults | 1 |
| Grade letter 1 | α |
| Letter grade boundary 1| 95 |
| Grade letter 2 | β |
| Letter grade boundary 2| 85 |
| Grade letter 3 | γ |
| Letter grade boundary 3| 70 |
| Grade letter 4 | δ |
| Letter grade boundary 4| 55 |
| Grade letter 5 | |
| Letter grade boundary 5| |
| Grade letter 6 | Ω |
| Letter grade boundary 6| 0 |
| Grade letter 7 | π |
| Letter grade boundary 7| 90 |
And I press "Save changes"
Then I should see "The default grade letters are currently overridden."
And the following should exist in the "grade-letters-view" table:
| Highest | Lowest | Letter |
| 100.00 % | 95.00 % | α |
| 94.99 % | 90.00 % | π |
| 89.99 % | 85.00 % | β |
| 84.99 % | 70.00 % | γ |
| 69.99 % | 55.00 % | δ |
| 54.99 % | 0.00 % | Ω |
@@ -0,0 +1,96 @@
@core @core_grades
Feature: We can change the grading type and maximum grade point values
In order to verify that we can change the system-level maximum grade point value
As an admin
I need to modify the system maximum grade point and ensure that activities can use the full range.
I need to ensure that using scales for activities still works correctly.
I need to ensure that the maximum grade point value is enforced for new and existing activities.
Background:
Given the following "courses" exist:
| fullname | shortname | category | format |
| Course 1 | C1 | 0 | topics |
Given the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | assign1 | Test Assignment 1 | Test Assignment 1 |
And I log in as "admin"
And I navigate to "Grades > General settings" in site administration
And I set the following fields to these values:
| Grade point maximum | 900 |
| Grade point default | 800 |
And I press "Save changes"
And I am on "Course 1" course homepage
@javascript
Scenario: Validate that switching the type of grading used correctly disables input form elements
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
Then the "Scale" "select" should be disabled
And the "Maximum grade" "field" should be enabled
And I set the field "grade[modgrade_type]" to "Scale"
And the "Maximum grade" "field" should be disabled
Then the "Scale" "select" should be enabled
And I set the field "grade[modgrade_type]" to "None"
Then the "Scale" "select" should be disabled
And the "Maximum grade" "field" should be disabled
And I press "Save and return to course"
@javascript
Scenario: Create an activity with a maximum grade point value less than the system maximum
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "point"
And I set the field "grade[modgrade_point]" to "600"
And I press "Save and display"
And I am on the "Test Assignment 1" "assign activity editing" page
Then the field "grade[modgrade_point]" matches value "600"
And the "Scale" "select" should be disabled
And I press "Save and return to course"
@javascript
Scenario: Create an activity with a scale as the grade type
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Scale"
And I set the field "grade[modgrade_scale]" to "Separate and Connected ways of knowing"
And I press "Save and display"
And I am on the "Test Assignment 1" "assign activity editing" page
Then the field "grade[modgrade_scale]" matches value "Separate and Connected ways of knowing"
And the "Maximum grade" "field" should be disabled
And I press "Save and return to course"
@javascript
Scenario: Create an activity with no grade as the grade type
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "None"
And I press "Save and display"
And I am on the "Test Assignment 1" "assign activity editing" page
And the "Scale" "select" should be disabled
And the "Maximum grade" "field" should be disabled
And I press "Save and return to course"
Scenario: Create an activity with a maximum grade point value higher than the system maximum
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
And I set the field "grade[modgrade_point]" to "20000"
And I press "Save and display"
Then I should see "Invalid grade value. This must be an integer between 1 and 900"
And I press "Cancel"
Scenario: Create an activity with a valid maximum grade point and then change the system maximum to be lower
Given I am on the "Test Assignment 1" "assign activity editing" page
When I expand all fieldsets
And I set the field "grade[modgrade_type]" to "point"
And I set the field "grade[modgrade_point]" to "600"
And I press "Save and display"
And I navigate to "Grades > General settings" in site administration
And I set the following fields to these values:
| Grade point maximum | 100 |
And I press "Save changes"
And I am on the "Test Assignment 1" "assign activity editing" page
And I press "Save and display"
Then I should see "Invalid grade value. This must be an integer between 1 and 100"
And I press "Cancel"
@@ -0,0 +1,51 @@
@core @core_grades @javascript
Feature: Admin can set Recover grades default setting
In order to recover grades
As an admin
I need to enable "Recover grades default" from site administration
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | One | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | name |
| assign | C1 | Assign 1 |
Scenario Outline: Recover grades default setting can be changed
Given the following config values are set as admin:
| recovergradesdefault | <recovergradesetting> |
# Grade student 1 via quick grading
And I am on the "Assign 1" "assign activity" page logged in as admin
And I follow "View all submissions"
And I click on "Quick grading" "checkbox"
And I set the field "User grade" to "60.00"
And I press "Save all quick grading changes"
# Confirm that assigned grade was saved
And I am on the "Course 1" "grades > Grader report > View" page
And I should see "60.00" in the "Student One" "table_row"
And I navigate to course participants
And I click on "Unenrol" "icon" in the "Student One" "table_row"
And I click on "Unenrol" "button" in the "Unenrol" "dialogue"
And I press "Enrol users"
And I set the field "Select users" to "student1"
# Confirm the "Recover user's old grades if possible" checkbox state based on Recover grades default setting
When I click on "Show more..." "link"
Then the field "Recover user's old grades if possible" matches value "<oldgraderecover>"
# Confirm that "Recover user's old grades if possible" checkbox state can be changed manually
And I click on "Recover user's old grades if possible" "checkbox" in the "Enrol users" "dialogue"
And I click on "Enrol users" "button" in the "Enrol users" "dialogue"
# Confirm whether re-enrolled student's grade is recovered or not based on student enrolment settings
And I am on the "Course 1" "grades > Grader report > View" page
And I <gradevisibility> see "60.00" in the "Student One" "table_row"
Examples:
| recovergradesetting | oldgraderecover | gradevisibility |
| 0 | 0 | should |
| 1 | 1 | should not |
@@ -0,0 +1,70 @@
@core @core_grades
Feature: Regrading grades does not unnecessarily mark some as overriden
In order to regrade a grade item
As an admin
I need to keep the overridden status of all grades
Background:
Given the following "courses" exist:
| fullname | shortname | category | format |
| Course 1 | C1 | 0 | topics |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
And the following "course enrolments" exist:
| user | course | role |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | assign1 | Assignment 1 | Assignment 1 intro |
And I log in as "admin"
And I navigate to "Grades > Grade category settings" in site administration
And I set the field "Available aggregation types" to "Weighted mean of grades"
And I press "Save changes"
And I am on the "Assignment 1" "assign activity" page
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "80"
And I press "Save and show next"
And I set the field "Grade out of 100" to "60"
And I press "Save changes"
And I am on the "Course 1" "grades > Grader report > View" page
And the following should exist in the "gradereport-grader-table" table:
| -1- | -3- | -4- |
| First name | Assignment 1 | Course total |
| Student 1 | 80.00 | 80.00 |
| Student 2 | 60.00 | 60.00 |
And I turn editing mode on
And I give the grade "80.00" to the user "Student 2" for the grade item "Course total"
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 "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
Scenario: Confirm regrading did not overwrite overridden status
Given I navigate to "View > Grader report" in the course gradebook
Then "td.overridden" "css_element" should not exist in the "Student 1" "table_row"
And "td.overridden" "css_element" should exist in the "Student 2" "table_row"
@javascript
Scenario: Confirm overridden course total does not get regraded when activity grade is changed
Given I am on the "Assignment 1" "assign activity" page
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade out of 100" to "90"
And I press "Save and show next"
And I set the field "Grade out of 100" to "70"
And I press "Save changes"
When I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode off
Then the following should exist in the "gradereport-grader-table" table:
| -1- | -3- | -4- |
| First name | Assignment 1 | Course total |
| Student 1 | 90.00 | 180.00 |
| Student 2 | 70.00 | 160.00 |
+161
View File
@@ -0,0 +1,161 @@
@core @core_grades @javascript
Feature: View gradebook when scales are used
In order to use scales to grade activities
As an teacher
I need to be able to view gradebook with scales
Background:
Given I log in as "admin"
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 | Letterscale |
| Scale | F,D,C,B,A |
And I press "Save changes"
And I log out
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
| student3 | Student | 3 | student3@example.com | s3 |
| student4 | Student | 4 | student4@example.com | s4 |
| student5 | Student | 5 | student5@example.com | s5 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
| student4 | C1 | student |
| student5 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| Sub category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory |
| assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 |
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 "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"
And I set the field "Grade" to "A"
And I press "Save changes"
And I click on "[data-action=next-user]" "css_element"
And I set the field "Grade" to "B"
And I press "Save changes"
And I click on "[data-action=next-user]" "css_element"
And I set the field "Grade" to "C"
And I press "Save changes"
And I click on "[data-action=next-user]" "css_element"
And I set the field "Grade" to "D"
And I press "Save changes"
And I click on "[data-action=next-user]" "css_element"
And I set the field "Grade" to "F"
And I press "Save changes"
And I am on "Course 1" course homepage
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
Scenario: Test displaying scales in gradebook in aggregation method Natural
When I turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- | -5- |
| Student 1 | student1@example.com | A | 5.00 | 5.00 |
| Student 2 | student2@example.com | B | 4.00 | 4.00 |
| Student 3 | student3@example.com | C | 3.00 | 3.00 |
| Student 4 | student4@example.com | D | 2.00 | 2.00 |
| Student 5 | student5@example.com | F | 1.00 | 1.00 |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | FA | 0.005.00 | 0.005.00 |
| Overall average | C | 3.00 | 3.00 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 3" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | C | FA | 50.00 % | 60.00 % |
| Sub category 1 total | 3.00 | 05 | 60.00 % | - |
| Course total | 3.00 | 05 | 60.00 % | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | 5.00 |
| Sub category 1 total | 5.00 |
| Course total | 5.00 |
And I log out
And I log in as "student2"
And I follow "Grades" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | B | FA | 75.00 % | 80.00 % |
| Sub category 1 total | 4.00 | 05 | 80.00 % | - |
| Course total | 4.00 | 05 | 80.00 % | - |
Scenario Outline: Test displaying scales in gradebook in all other aggregation methods
Given I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | <aggregation> |
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 turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- | -5- |
| Student 1 | student1@example.com | A | 5.00 | <coursetotal1> |
| Student 2 | student2@example.com | B | 4.00 | <coursetotal2> |
| Student 3 | student3@example.com | C | 3.00 | <coursetotal3> |
| Student 4 | student4@example.com | D | 2.00 | <coursetotal4> |
| Student 5 | student5@example.com | F | 1.00 | <coursetotal5> |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | FA | 1.005.00 | 0.00100.00 |
| Overall average | C | 3.00 | <overallavg> |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 3" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | C | FA | 50.00 % | <contrib3> |
| Sub category (<aggregation>) total | 3.00 | 15 | 50.00 % | - |
| Course total | <coursetotal3> | 0100 | <courseperc3> | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | A (5) |
| Sub category (<aggregation>) total | |
| Course total | |
And I log out
And I log in as "student2"
And I follow "Grades" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage | Contribution to course total |
| Test assignment one | B | FA | 75.00 % | <contrib2> |
| Sub category (<aggregation>) total | 4.00 | 15 | 75.00 % | - |
| Course total | <coursetotal2> | 0100 | <courseperc2> | - |
Examples:
| aggregation | coursetotal1 | coursetotal2 | coursetotal3 | coursetotal4 | coursetotal5 |overallavg | courseperc2 | courseperc3 | contrib2 | contrib3 |
| Mean of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
| Weighted mean of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
| Simple weighted mean of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
| Mean of grades (with extra credits) | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
| Median of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
| Lowest grade | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
| Highest grade | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
| Mode of grades | 100.00 | 75.00 | 50.00 | 25.00 | 0.00 | 50.00 | 75.00 % | 50.00 % | 75.00 % | 50.00 % |
@@ -0,0 +1,103 @@
@core @core_grades @javascript
Feature: Control the aggregation of the scales
In order to use control the aggregation of the scales
As an admin
I can change use administration setting
Background:
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
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 |
| grade_report_user_showcontributiontocoursetotal | 1 |
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 | Letterscale |
| Scale | F,D,C,B,A |
And I press "Save changes"
And the following "grade items" exist:
| itemname | course |
| Grade me | C1 |
And the following "grade items" exist:
| itemname | course | scale |
| Scale me | C1 | Letterscale |
And the following config values are set as admin:
| grade_includescalesinaggregation | 0 |
Scenario Outline: Scales can be excluded from aggregation
Given I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
When I give the grade "10" to the user "Student 1" for the grade item "Grade me"
And I give the grade "B" to the user "Student 1" for the grade item "Scale me"
And I press "Save changes"
And I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | <aggregation> |
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:
| Grade item | Grade | Percentage | Contribution to course total |
| Grade me | 10.00 | 10.00 % | <gradecontrib> |
| Scale me | B | 75.00 % | <scalecontrib> |
| Course total | <coursetotal> | <coursepc> | - |
And I log out
And I log in as "admin"
And I set the following administration settings values:
| grade_includescalesinaggregation | 1 |
And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Percentage | Contribution to course total |
| Grade me | 10.00 | 10.00 % | <gradecontrib2> |
| Scale me | B | 75.00 % | <scalecontrib2> |
| Course total | <coursetotal2> | <coursepc2> | - |
Examples:
| aggregation | coursetotal | coursepc | gradecontrib | scalecontrib | coursetotal2 | coursepc2 | gradecontrib2 | scalecontrib2 |
| Natural | 10.00 | 10.00 % | 10.00 | 0.00 | 14.00 | 13.33 % | 9.52 % | 3.81 % |
| Mean of grades | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
| Weighted mean of grades | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
| Simple weighted mean of grades | 10.00 | 10.00 % | 10.00 | 0.00 | 12.50 | 12.50 % | 9.62 % | 2.88 % |
| Mean of grades (with extra credits) | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
| Median of grades | 10.00 | 10.00 % | 10.00 | 0.00 | 42.50 | 42.50 % | 5.00 % | 37.50 % |
| Lowest grade | 10.00 | 10.00 % | 10.00 | 0.00 | 10.00 | 10.00 % | 10.00 % | 0.00 % |
| Highest grade | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
| Mode of grades | 10.00 | 10.00 % | 10.00 | 0.00 | 75.00 | 75.00 % | 0.00 % | 75.00 % |
Scenario: Weights of scales cannot be edited when they are not aggregated
Given I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
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 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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
And I should not see "Weight adjusted"
And I should not see "Weight"
And the following config values are set as admin:
| grade_includescalesinaggregation | 1 |
And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the field "Override weight of Grade me" to "1"
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 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 click on "Show more..." "link" in the ".modal-dialog" "css_element"
And I should see "Weight adjusted"
And I should see "Weight"
@@ -0,0 +1,27 @@
@core @core_grades
Feature: We can view the logs for any changes to grade scales.
In order to view changes grade scales
As an administrator
I need to add make changes and then view the logs.
Scenario: I edit scales and then view the logs.
Given I log in as "admin"
And I navigate to "Grades > Scales" in site administration
# Add a scale
And I press "Add a new scale"
And I set the following fields to these values:
| Name | Letterscale |
| Scale | F,D,C,B,A |
And I press "Save changes"
# Delete first scale
And I follow "Delete"
And I press "Continue"
# Edit first scale
And I follow "Edit"
And I set the following fields to these values:
| id_scale | ONE,TWO,THREE |
And I press "Save changes"
When I navigate to "Reports > Live logs" in site administration
Then I should see "Scale created"
And I should see "Scale updated"
And I should see "Scale deleted"
@@ -0,0 +1,125 @@
@core @core_grades @javascript
Feature: View gradebook when single item scales are used
In order to use single item scales to grade activities
As an teacher
I need to be able to view gradebook with single item scales
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> Singleitem |
| Scale | Ace! |
And I press "Save changes"
And I log out
And the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | t1 |
| student1 | Student | 1 | student1@example.com | s1 |
| student2 | Student | 2 | student2@example.com | s2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And the following "grade categories" exist:
| fullname | course |
| <span lang='en' class='multilang'>EN</span><span lang='fr' class='multilang'>FR</span> Sub category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory |
| assign | C1 | a1 | Test assignment one | Submit something! | <span lang='en' class='multilang'>EN</span><span lang='fr' class='multilang'>FR</span> Sub category 1 |
And the "multilang" filter is "on"
And the "multilang" filter applies to "content and headings"
And I am on the "Test assignment one" "assign activity editing" page logged in as teacher1
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 Singleitem"
And I press "Save and display"
And I follow "View all submissions"
And I click on "Grade" "link" in the "Student 1" "table_row"
And I set the field "Grade" to "A"
And I press "Save changes"
When I am on the "Course 1" "grades > course grade settings" page
And I set the field "Show weightings" to "Show"
And I set the field "Show contribution to course total" to "Show"
And I press "Save changes"
And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on
Scenario: Test displaying single item scales in gradebook in aggregation method Natural
When I turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- | -5- |
| Student 1 | student1@example.com | Ace! | 1.00 | 1.00 |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | Ace!Ace! | 0.001.00 | 0.001.00 |
| Overall average | Ace! | 1.00 | 1.00 |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | Ace! | Ace!Ace! | 100.00 % |
| ENFR Sub category 1 total | 1.00 | 01 | - |
| Course total | 1.00 | 01 | - |
And I click on "Student 2" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | - | Ace!Ace! | - |
| ENFR Sub category 1 total | - | 01 | - |
| Course total | - | 01 | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | 1.00 |
| ENFR Sub category 1 total | 1.00 |
| Course total | 1.00 |
Scenario Outline: Test displaying single item scales in gradebook in all other aggregation methods
Given I set the following settings for grade item "Course 1" of type "course" on "grader" page:
| Aggregation | <aggregation> |
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 turn editing mode off
Then the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- | -5- |
| Student 1 | student1@example.com | Ace! | <cattotal1> | <coursetotal1> |
| Student 2 | student2@example.com | - | - | - |
And the following should exist in the "user-grades" table:
| -1- | -2- | -3- | -4- |
| Range | Ace!Ace! | 0.00100.0 | 0.00100.00 |
| Overall average | Ace! | <catavg> | <overallavg> |
And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Contribution to course total |
| Test assignment one | Ace! | Ace!Ace! | <contrib1> |
| Sub category (<aggregation>) total | <cattotal1> | 0100 | - |
| Course total | <coursetotal1> | 0100 | - |
And I navigate to "Setup > Gradebook setup" in the course gradebook
And the following should exist in the "grade_edit_tree_table" table:
| Name | Max grade |
| Test assignment one | Ace! (1) |
| Sub category (<aggregation>) total | 100.00 |
| Course total | 100.00 |
Examples:
| aggregation | contrib1 | cattotal1 | coursetotal1 | catavg | overallavg |
| Mean of grades | 100.00 % | 100.00 | 100.00 | 100.00 | 100.00 |
| Weighted mean of grades | 0.00 % | 100.00 | 100.00 | 100.00 | 100.00 |
| Simple weighted mean of grades | 0.00 % | - | - | - | - |
| Mean of grades (with extra credits) | 100.00 % | 100.00 | 100.00 | 100.00 | 100.00 |
| Median of grades | 100.00 % | 100.00 | 100.00 | 100.00 | 100.00 |
| Lowest grade | 100.00 % | 100.00 | 100.00 | 100.00 | 100.00 |
| Highest grade | 100.00 % | 100.00 | 100.00 | 100.00 | 100.00 |
| Mode of grades | 100.00 % | 100.00 | 100.00 | 100.00 | 100.00 |
+303
View File
@@ -0,0 +1,303 @@
@core @core_grades @javascript
Feature: We can set the grade to pass value
In order to set the grade to pass value
As a teacher
I assign a grade to pass to an activity while editing the activity.
I need to ensure that the grade to pass is visible in the gradebook.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format | numsections |
| Course 1 | C1 | weeks | 5 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "scales" exist:
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
And the following "activity" exists:
| activity | assign |
| course | C1 |
| section | 1 |
| idnumber | assign1 |
| name | Test Assignment 1 |
| intro | Submit your online text |
| assignsubmission_onlinetext_enabled | 1 |
And I am on the "Course 1" course page logged in as teacher1
Scenario: Validate that switching the type of grading used correctly disables grade to pass
Given I turn editing mode on
And I am on the "Test Assignment 1" "assign activity" page
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
Then the "Grade to pass" "field" should be enabled
And I set the field "grade[modgrade_type]" to "None"
And the "Grade to pass" "field" should be disabled
And I press "Save and return to course"
Scenario: Create an activity with a Grade to pass value greater than the maximum grade
When I turn editing mode on
And I am on the "Test Assignment 1" "assign activity" page
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the field "grade[modgrade_type]" to "Point"
And I set the field "grade[modgrade_point]" to "50"
And I set the field "Grade to pass" to "100"
And I press "Save and return to course"
Then I should see "The grade to pass can not be greater than the maximum possible grade 50"
And I press "Cancel"
Scenario: Set a valid grade to pass for an assignment activity using points
When I turn editing mode on
And I am on the "Test Assignment 1" "assign activity" page
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| assignsubmission_onlinetext_enabled | 1 |
| grade[modgrade_type] | Point |
| grade[modgrade_point] | 50 |
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "25"
And I am on "Course 1" course homepage
And I am on the "Test Assignment 1" "assign activity" page
And I navigate to "Settings" in current page administration
And I expand all fieldsets
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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the field "Grade to pass" matches value "30"
Scenario: Set a valid grade to pass for an assignment activity using scales
When I turn editing mode on
And I am on the "Test Assignment 1" "assign activity" page
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| grade[modgrade_type] | Scale |
| grade[modgrade_scale] | Test Scale 1 |
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "3"
And I set the field "Grade to pass" to "4"
And I press "Save changes"
And I am on "Course 1" course homepage
And I am on the "Test Assignment 1" "assign activity" page
And I navigate to "Settings" in current page administration
And the field "Grade to pass" matches value "4"
Scenario: Set a invalid grade to pass for an assignment activity using scales
When I turn editing mode on
And I am on the "Test Assignment 1" "assign activity" page
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| grade[modgrade_type] | Scale |
| grade[modgrade_scale] | Test Scale 1 |
| Grade to pass | 10 |
And I press "Save and return to course"
Then I should see "The grade to pass can not be greater than the maximum possible grade 4"
Scenario: Set a valid grade to pass for workshop activity
Given the following "activities" exist:
| activity | name | course | idnumber |
| workshop | Test Workshop 1 | C1 | workshop1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Workshop 1" "workshop activity editing" page
And I set the following fields to these values:
| grade | 80 |
| Submission grade to pass | 40 |
| gradinggrade | 20 |
| 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)" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
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)" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the field "Grade to pass" matches value "10"
And I set the field "Grade to pass" to "15"
And I press "Save changes"
And I am on the "Test Workshop 1" "workshop activity editing" page
And the field "Submission grade to pass" matches value "45"
And the field "Assessment grade to pass" matches value "15"
Scenario: Set an invalid grade to pass for workshop activity
Given the following "activities" exist:
| activity | name | course | idnumber |
| workshop | Test Workshop 1 | C1 | workshop1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Workshop 1" "workshop activity editing" page
And I set the following fields to these values:
| grade | 80 |
| Submission grade to pass | 90 |
| gradinggrade | 20 |
| Assessment grade to pass | 30 |
And I press "Save and return to course"
Then "The grade to pass can not be greater than the maximum possible grade 80" "text" should exist in the "Submission grade to pass" "form_row"
Then "The grade to pass can not be greater than the maximum possible grade 20" "text" should exist in the "Assessment grade to pass" "form_row"
Scenario: Set a valid grade to pass for quiz activity
Given the following "activities" exist:
| activity | name | course | section | idnumber |
| quiz | Test Quiz 1 | C1 | 1 | quiz1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Quiz 1" "quiz activity" page
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "9.5"
And I set the field "Grade to pass" to "8"
And I press "Save changes"
And I am on "Course 1" course homepage
And I am on the "Test Quiz 1" "quiz activity" page
And I follow "Settings"
And the field "Grade to pass" matches value "8.00"
Scenario: Set a valid grade to pass for lesson activity
Given the following "activities" exist:
| activity | name | course | idnumber |
| lesson | Test Lesson 1 | C1 | lesson1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Lesson 1" "lesson activity editing" page
And I set the following fields to these values:
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
And I press "Save changes"
And I am on the "Test Lesson 1" "lesson activity editing" page
And the field "Grade to pass" matches value "80"
Scenario: Set a valid grade to pass for lesson activity with custom decimal separator
Given the following "activities" exist:
| activity | name | course | idnumber |
| lesson | Test Lesson 1 | C1 | lesson1 |
And the following "language customisations" exist:
| component | stringid | value |
| core_langconfig | decsep | # |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Lesson 1" "lesson activity editing" page
And I set the following fields to these values:
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90#50"
And I set the field "Grade to pass" to "80"
And I press "Save changes"
And I am on the "Test Lesson 1" "lesson activity editing" page
And the field "Grade to pass" matches value "80#00"
Scenario: Set a valid grade to pass for database activity
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| data | Test Database 1 | Test | C1 | 1 | data1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Database 1" "data activity" page
And I navigate to "Settings" in current page administration
And I expand all fieldsets
And I set the following fields to these values:
| Ratings > Aggregate type | Average of ratings |
| id_scale_modgrade_type | Point |
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
And I press "Save changes"
And I am on "Course 1" course homepage
And I am on the "Test Database 1" "data activity" page
And I follow "Settings"
And the field "Grade to pass" matches value "80"
Scenario: Set an invalid grade to pass for forum activity
Given the following "activities" exist:
| activity | name | course | idnumber |
| forum | Test Forum 1 | C1 | forum1 |
And I am on the "Test Forum 1" "forum activity editing" page
And I expand all fieldsets
And I set the following fields to these values:
| Ratings > Aggregate type | Average of ratings |
| id_scale_modgrade_type | Point |
| Ratings > Grade to pass | 90 |
| Ratings > scale[modgrade_point] | 60 |
And I press "Save and return to course"
Then I should see "The grade to pass can not be greater than the maximum possible grade 60"
Scenario: Set a valid grade to pass for forum activity
Given the following "activities" exist:
| activity | name | course | idnumber |
| forum | Test Forum 1 | C1 | forum1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Forum 1" "forum activity editing" page
And I expand all fieldsets
And I set the following fields to these values:
| Ratings > Aggregate type | Average of ratings |
| id_scale_modgrade_type | Point |
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
And I press "Save changes"
And I am on the "Test Forum 1" "forum activity editing" page
And the field "Ratings > Grade to pass" matches value "80"
Scenario: Set a valid grade to pass for glossary activity
Given the following "activities" exist:
| activity | name | intro | course | section | idnumber |
| glossary | Test Glossary 1 | Test | C1 | 1 | glossary1 |
And I am on "Course 1" course homepage with editing mode on
And I am on the "Test Glossary 1" "glossary activity" page
And I navigate to "Settings" in current page administration
And I set the following fields to these values:
| Ratings > Aggregate type | Average of ratings |
| id_scale_modgrade_type | Point |
| 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" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu
And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80"
And I press "Save changes"
And I am on "Course 1" course homepage
And I am on the "Test Glossary 1" "glossary activity" page
And I follow "Settings"
And the field "Grade to pass" matches value "80"
+94
View File
@@ -0,0 +1,94 @@
@core @core_grades @javascript
Feature: We can enter in grades and view reports from the gradebook
In order to check the expected results are displayed
As a teacher
I need to assign grades and check that they display correctly in the gradebook.
I need to enable grade weightings and check that they are displayed correctly.
Background:
Given the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | name | course | idnumber | assignsubmission_onlinetext_enabled |
| assign | Test assignment name 1 | C1 | assign1 | 1 |
| assign | Test assignment name 2 | C1 | assign2 | 1 |
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 |
And I am on the "Test assignment name 1" "assign activity" page logged in as student1
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is a submission for assignment 1 |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
Then I should see "Submitted for grading"
And I am on the "Test assignment name 2" "assign activity" page
When I press "Add submission"
And I set the following fields to these values:
| Online text | This is a submission for assignment 2 |
And I press "Save changes"
And I press "Submit assignment"
And I press "Continue"
Then I should see "Submitted for grading"
And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
And I turn editing mode on
And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment name 1"
And I give the grade "90.00" to the user "Student 1" for the grade item "Test assignment name 2"
And I press "Save changes"
Scenario: Grade a grade item and ensure the results display correctly in the gradebook
When I navigate to "View > User report" in the course gradebook
And the "Gradebook navigation menu" select menu should contain "Grader report"
And I set the field "Search users" to "Student"
And "View all results (1)" "list_item" should exist
And I click on "View all results (1)" "option_role"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
Then the following should exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage |
| Test assignment name 1 | 80.00 | 0100 | 80.00 % |
| Test assignment name 2 | 90.00 | 0100 | 90.00 % |
| Course total | 170.00 | 0200 | 85.00 % |
And the following should not exist in the "user-grade" table:
| Grade item | Grade | Range | Percentage |
| Course total | 90.00 | 0100 | 90.00 % |
And I follow "Grades" in the user menu
And "Course 1" row "Grade" column of "overview-grade" table should contain "170.00"
And "Course 1" row "Grade" column of "overview-grade" table should not contain "90.00"
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" 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"
And I navigate to "Setup > Course grade settings" in the course gradebook
And I set the following fields to these values:
| Show weightings | Show |
And I press "Save changes"
And I log out
And I log in as "student1"
And I follow "Grades" in the user menu
And I click on "Course 1" "link" in the "region-main" "region"
Then the following should exist in the "user-grade" table:
| Grade item | Calculated weight | Grade | Range | Percentage |
| Test assignment name 1 | 41.86 % | 80.00 | 0100 | 80.00 % |
| Test assignment name 2 | 58.14 % | 90.00 | 0100 | 90.00 % |
| Course total | - | 85.81 | 0100 | 85.81 % |
And the following should not exist in the "user-grade" table:
| Grade item | Calculated weight | Percentage |
| Test assignment name 1 | 0.72% | 0.72% |
| Test assignment name 2 | 1.00% | 1.00% |
| Course total | 1.00% | 1.00% |
@@ -0,0 +1,27 @@
@core @core_grades @javascript
Feature: Verify the breadcrumbs in grade outcomes site administration pages
Whenever I navigate to advanced features page in site administration
As an admin
The breadcrumbs should be visible
Background:
Given I log in as "admin"
Scenario: Verify the breadcrumbs in grades outcomes by adding a new outcome, visiting editing page and visiting delete page as an admin
Given I navigate to "Advanced features" in site administration
And I click on "Enable outcomes" "checkbox"
And I press "Save changes"
And I navigate to "Grades > Outcomes" in site administration
And I click on "Add a new outcome" "button"
And "Add an outcome" "text" should exist in the ".breadcrumb" "css_element"
And "Outcomes" "link" should exist in the ".breadcrumb" "css_element"
And I set the field "Full name" to "Outcome test"
And I set the field "Short name" to "outcome_test"
And I press "Save changes"
When I click on "Edit" "link"
Then "Edit outcome" "text" should exist in the ".breadcrumb" "css_element"
And "Outcomes" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
And I click on "Delete" "link"
And "Delete outcome" "text" should exist in the ".breadcrumb" "css_element"
And "Outcomes" "link" should exist in the ".breadcrumb" "css_element"
@@ -0,0 +1,23 @@
@core_grades @javascript
Feature: Verify the breadcrumbs in grade scales site administration pages
Whenever I navigate to grade scales page in site administration
As an admin
The breadcrumbs should be visible
Background:
Given I log in as "admin"
@core_grades
Scenario: Verify the breadcrumbs in scales page as an admin
Given I navigate to "Grades > Scales" in site administration
And I click on "Add a new scale" "button"
And "Add a scale" "text" should exist in the ".breadcrumb" "css_element"
And "Scales" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
When I click on "Edit" "link"
Then "Edit scale" "text" should exist in the ".breadcrumb" "css_element"
And "Scales" "link" should exist in the ".breadcrumb" "css_element"
And I press "Cancel"
And I click on "Delete" "link"
And "Delete scale" "text" should exist in the ".breadcrumb" "css_element"
And "Scales" "link" should exist in the ".breadcrumb" "css_element"
@@ -0,0 +1,247 @@
@core @core_grades @javascript
Feature: Teachers can toggle the visibility of the grade categories in the Gradebook setup page.
In order to focus only on the information that I am interested in
As a teacher
I need to be able to easily toggle the visibility of grade categories in the Gradebook setup page
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher 1 | 1 | teacher1@example.com | t1 |
| teacher2 | Teacher 2 | 2 | teacher2@example.com | t2 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | editingteacher |
And the following "grade categories" exist:
| fullname | course |
| Category 1 | C1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| assign | C1 | a1 | Test assignment one | Submit something! |
And the following "activities" exist:
| activity | course | idnumber | name | intro | gradecategory |
| assign | C1 | a2 | Test assignment two | Submit something! | Category 1 |
And the following "grade items" exist:
| itemname | grademax | course | gradecategory |
| Manual grade | 40 | C1 | Category 1 |
And I am on the "Course" "grades > gradebook setup" page logged in as "teacher1"
Scenario: A teacher can collapse and expand grade categories in the Gradebook setup page
Given the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse the grade category 'Category 1'.
When I click on "Collapse" "link" in the "Category 1" "table_row"
Then the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And the following should not exist in the "setup-grades" table:
| Test assignment two |
| Manual grade |
| Category 1 total |
# Expand the grade category 'Category 1'.
And I click on "Expand" "link" in the "Category 1" "table_row"
And the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse again the grade category 'Category 1'.
And I click on "Collapse" "link" in the "Category 1" "table_row"
# Collapse the grade category 'Course'.
And I click on "Collapse" "link" in the "Course" "table_row"
And the following should exist in the "setup-grades" table:
| Name |
| Course |
And I should see "Course" in the "setup-grades" "table"
And "Expand" "link" should exist in the "Course" "table_row"
And I should not see "Test assignment one" in the "setup-grades" "table"
And I should not see "Category 1" in the "setup-grades" "table"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
And I should not see "Category 1 total" in the "setup-grades" "table"
And I should not see "Course total" in the "setup-grades" "table"
# Expand the grade category 'Course'. 'Category 1' should be still collapsed.
And I click on "Expand" "link" in the "Course" "table_row"
And the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
And I should not see "Category 1 total" in the "setup-grades" "table"
Scenario: A teacher can see the aggregated max grade for a grade category even when the category is collapsed
Given the following should exist in the "setup-grades" table:
| Name | Max grade |
| Course | |
| Category 1 | |
| Category 1 total | 140.00 |
| Course total | 240.00 |
# Collapse the grade category 'Category 1'. The aggregated max grade should now be displayed within the 'Category 1' row.
When I click on "Collapse" "link" in the "Category 1" "table_row"
Then the following should exist in the "setup-grades" table:
| Name | Max grade |
| Course | |
| Category 1 | 140.00 |
| Course total | 240.00 |
And I should not see "Category 1 total" in the "setup-grades" "table"
# Collapse the grade category 'Course'. The aggregated max grade should now be displayed within the 'Course' row.
And I click on "Collapse" "link" in the "Course" "table_row"
And "Course" row "Max grade" column of "setup-grades" table should contain "240.00"
And I should not see "Course total" in the "setup-grades" "table"
# Expand the grade category 'Course'. The aggregated max grade should not be displayed within the 'Course' row anymore.
And I click on "Expand" "link" in the "Course" "table_row"
And the following should exist in the "setup-grades" table:
| Name | Max grade |
| Course | |
| Category 1 | 140.00 |
| Course total | 240.00 |
And I should not see "Category 1 total" in the "setup-grades" "table"
Scenario: A teacher can collapse and expand grade categories in the Gradebook setup when moving grade items
Given I click on "Move" "link" in the "Test assignment one" "table_row"
And the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Test assignment two |
| Manual grade |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse the grade category 'Category 1'.
When I click on "Collapse" "link" in the "Category 1" "table_row"
Then the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
And I should not see "Category 1 total" in the "setup-grades" "table"
# Expand the grade category 'Category 1'.
And I click on "Expand" "link" in the "Category 1" "table_row"
And the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Test assignment two |
| Manual grade |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse again the grade category 'Category 1'.
And I click on "Collapse" "link" in the "Category 1" "table_row"
# Collapse the grade category 'Course'.
And I click on "Collapse" "link" in the "Course" "table_row"
And I should see "Course" in the "setup-grades" "table"
And "Expand" "link" should exist in the "Course" "table_row"
And I should not see "Test assignment one" in the "setup-grades" "table"
And I should not see "Category 1" in the "setup-grades" "table"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
# Expand the grade category 'Course'. 'Category 1' should be still collapsed.
And I click on "Expand" "link" in the "Course" "table_row"
And the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
And I should not see "Category 1 total" in the "setup-grades" "table"
Scenario: Previously collapsed categories are still shown as collapsed when a teacher navigates back to Gradebook setup
# Collapse the grade category 'Category 1' and navigate to the course homepage.
Given I click on "Collapse" "link" in the "Category 1" "table_row"
# Navigate back to Gradebook setup and confirm that the category 'Category 1' is still collapsed.
When I am on the "Course" "grades > gradebook setup" page
Then the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
And I should not see "Category 1 total" in the "setup-grades" "table"
Scenario: Previously collapsed categories are still shown as collapsed when a teacher is moving grade items in Gradebook setup
# Collapse the grade category 'Category 1'.
Given I click on "Collapse" "link" in the "Category 1" "table_row"
# Attempt to move a grade item and confirm that the category 'Category 1' is still collapsed.
When I click on "Move" "link" in the "Test assignment one" "table_row"
Then the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
And I should not see "Category 1 total" in the "setup-grades" "table"
Scenario: Grade categories are shown as collapsed only to the teacher that collapsed them
# Collapse the grade category 'Category 1'.
Given I click on "Collapse" "link" in the "Category 1" "table_row"
When I reload the page
# Reload the page and confirm that the category 'Category 1' is still collapsed.
Then the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And I should not see "Test assignment two" in the "setup-grades" "table"
And I should not see "Manual grade" in the "setup-grades" "table"
And I should not see "Category 1 total" in the "setup-grades" "table"
# Log in as teacher2 and confirm that the category 'Category 1' is not collapsed.
And I am on the "Course" "grades > gradebook setup" page logged in as "teacher2"
And the following should exist in the "setup-grades" table:
| Name |
| Course |
| Test assignment one |
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"