MDL-77637 gradebook_setup: Create gradeitems via dyn form

This commit is contained in:
Mathew May 2023-06-02 14:22:19 +08:00
parent 1b1a15a308
commit 997134f52f
33 changed files with 862 additions and 156 deletions

View file

@ -334,21 +334,21 @@ Feature: Set up contextual data for tests
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And I expand all fieldsets And I expand all fieldsets
And I should see "Course 1" And I should see "Course 1"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
And I should see "Grade category 1" And I should see "Grade category 1"
And I should see "Test Grade Item 2" And I should see "Test Grade Item 2"
And I click on grade item menu "Test Grade Item 2" of type "gradeitem" on "setup" page And I click on grade item menu "Test Grade Item 2" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And I expand all fieldsets And I expand all fieldsets
And I should see "Grade category 1" And I should see "Grade category 1"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
And I should see "Grade sub category 2" And I should see "Grade sub category 2"
And I should see "Test Grade Item 3" And I should see "Test Grade Item 3"
And I click on grade item menu "Test Grade Item 3" of type "gradeitem" on "setup" page And I click on grade item menu "Test Grade Item 3" of type "gradeitem" on "setup" page
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And I expand all fieldsets And I expand all fieldsets
And I should see "Grade sub category 2" And I should see "Grade sub category 2"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
Scenario: Add a bunch of scales Scenario: Add a bunch of scales
Given the following "courses" exist: Given the following "courses" exist:

View file

@ -0,0 +1,10 @@
define("core_grades/gradebooksetup_forms",["exports","core_form/modalform","core/str","core/notification"],(function(_exports,_modalform,_str,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Prints the add item gradebook form
*
* @module core_grades
* @copyright 2023 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modalform=_interopRequireDefault(_modalform),_notification=_interopRequireDefault(_notification);_exports.init=()=>{document.addEventListener("click",(event=>{if(event.target.closest('[data-trigger="add-item-form"]')){event.preventDefault();const trigger=event.target.closest('[data-trigger="add-item-form"]'),title="-1"===trigger.getAttribute("data-itemid")?(0,_str.get_string)("newitem","core_grades"):(0,_str.get_string)("itemsedit","core_grades"),modalForm=new _modalform.default({modalConfig:{title:title},formClass:"core_grades\\form\\add_item",args:{itemid:trigger.getAttribute("data-itemid"),courseid:trigger.getAttribute("data-courseid"),gpr_plugin:trigger.getAttribute("data-gprplugin")},saveButtonText:(0,_str.get_string)("save","core"),returnFocus:trigger});modalForm.addEventListener(modalForm.events.FORM_SUBMITTED,(event=>{event.detail.result?window.location.assign(event.detail.url):_notification.default.addNotification({type:"error",message:(0,_str.get_string)("saving_failed","core_grades")})})),modalForm.show()}}))}}));
//# sourceMappingURL=gradebooksetup_forms.min.js.map

View file

@ -0,0 +1 @@
{"version":3,"file":"gradebooksetup_forms.min.js","sources":["../src/gradebooksetup_forms.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Prints the add item gradebook form\n *\n * @module core_grades\n * @copyright 2023 Mathew May <mathew.solutions>\n * @license http://www.gnu.org/copyleft/gpl.html GNU Public License\n */\n\nimport ModalForm from 'core_form/modalform';\nimport {get_string as getString} from 'core/str';\nimport Notification from 'core/notification';\n\n/**\n * Initialize module\n */\nexport const init = () => {\n // Sometimes the trigger does not exist, so lets conditionally add it.\n document.addEventListener('click', event => {\n if (event.target.closest('[data-trigger=\"add-item-form\"]')) {\n event.preventDefault();\n const trigger = event.target.closest('[data-trigger=\"add-item-form\"]');\n // If we are adding or editing a grade item change the Modal header.\n const title = trigger.getAttribute('data-itemid') === '-1' ?\n getString('newitem', 'core_grades') : getString('itemsedit', 'core_grades');\n const modalForm = new ModalForm({\n modalConfig: {\n title: title,\n },\n formClass: 'core_grades\\\\form\\\\add_item',\n args: {\n itemid: trigger.getAttribute('data-itemid'),\n courseid: trigger.getAttribute('data-courseid'),\n gpr_plugin: trigger.getAttribute('data-gprplugin'),\n },\n saveButtonText: getString('save', 'core'),\n returnFocus: trigger,\n });\n\n // Show a toast notification when the form is submitted.\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {\n if (event.detail.result) {\n window.location.assign(event.detail.url);\n } else {\n Notification.addNotification({\n type: 'error',\n message: getString('saving_failed', 'core_grades')\n });\n }\n });\n\n modalForm.show();\n }\n });\n};\n"],"names":["document","addEventListener","event","target","closest","preventDefault","trigger","title","getAttribute","modalForm","ModalForm","modalConfig","formClass","args","itemid","courseid","gpr_plugin","saveButtonText","returnFocus","events","FORM_SUBMITTED","detail","result","window","location","assign","url","addNotification","type","message","show"],"mappings":";;;;;;;kMA8BoB,KAEhBA,SAASC,iBAAiB,SAASC,WAC3BA,MAAMC,OAAOC,QAAQ,kCAAmC,CACxDF,MAAMG,uBACAC,QAAUJ,MAAMC,OAAOC,QAAQ,kCAE/BG,MAAgD,OAAxCD,QAAQE,aAAa,gBAC/B,mBAAU,UAAW,gBAAiB,mBAAU,YAAa,eAC3DC,UAAY,IAAIC,mBAAU,CAC5BC,YAAa,CACTJ,MAAOA,OAEXK,UAAW,8BACXC,KAAM,CACFC,OAAQR,QAAQE,aAAa,eAC7BO,SAAUT,QAAQE,aAAa,iBAC/BQ,WAAYV,QAAQE,aAAa,mBAErCS,gBAAgB,mBAAU,OAAQ,QAClCC,YAAaZ,UAIjBG,UAAUR,iBAAiBQ,UAAUU,OAAOC,gBAAgBlB,QACpDA,MAAMmB,OAAOC,OACbC,OAAOC,SAASC,OAAOvB,MAAMmB,OAAOK,2BAEvBC,gBAAgB,CACzBC,KAAM,QACNC,SAAU,mBAAU,gBAAiB,oBAKjDpB,UAAUqB"}

View file

@ -0,0 +1,69 @@
// 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/>.
/**
* Prints the add item gradebook form
*
* @module core_grades
* @copyright 2023 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
*/
import ModalForm from 'core_form/modalform';
import {get_string as getString} from 'core/str';
import Notification from 'core/notification';
/**
* Initialize module
*/
export const init = () => {
// Sometimes the trigger does not exist, so lets conditionally add it.
document.addEventListener('click', event => {
if (event.target.closest('[data-trigger="add-item-form"]')) {
event.preventDefault();
const trigger = event.target.closest('[data-trigger="add-item-form"]');
// If we are adding or editing a grade item change the Modal header.
const title = trigger.getAttribute('data-itemid') === '-1' ?
getString('newitem', 'core_grades') : getString('itemsedit', 'core_grades');
const modalForm = new ModalForm({
modalConfig: {
title: title,
},
formClass: 'core_grades\\form\\add_item',
args: {
itemid: trigger.getAttribute('data-itemid'),
courseid: trigger.getAttribute('data-courseid'),
gpr_plugin: trigger.getAttribute('data-gprplugin'),
},
saveButtonText: getString('save', 'core'),
returnFocus: trigger,
});
// Show a toast notification when the form is submitted.
modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {
if (event.detail.result) {
window.location.assign(event.detail.url);
} else {
Notification.addNotification({
type: 'error',
message: getString('saving_failed', 'core_grades')
});
}
});
modalForm.show();
}
});
};

View file

@ -0,0 +1,593 @@
<?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/>.
namespace core_grades\form;
defined('MOODLE_INTERNAL') || die;
use context;
use context_course;
use core_form\dynamic_form;
use grade_category;
use grade_item;
use grade_plugin_return;
use grade_scale;
use moodle_url;
require_once($CFG->dirroot.'/grade/lib.php');
/**
* Prints the add item gradebook form
*
* @copyright 2023 Mathew May <mathew.solutions>
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package core_grades
*/
class add_item extends dynamic_form {
/** Grade plugin return tracking object.
* @var object $gpr
*/
public $gpr;
/**
* Helper function to grab the current grade item based on information within the form.
*
* @return array
* @throws \moodle_exception
*/
private function get_gradeitem(): array {
$courseid = $this->optional_param('courseid', null, PARAM_INT);
$id = $this->optional_param('itemid', null, PARAM_INT);
if ($gradeitem = grade_item::fetch(['id' => $id, 'courseid' => $courseid])) {
// Redirect if outcomeid present.
if (!empty($gradeitem->outcomeid) && !empty($CFG->enableoutcomes)) {
$url = new moodle_url('/grade/edit/tree/outcomeitem.php', ['id' => $id, 'courseid' => $courseid]);
redirect($this->gpr->add_url_params($url));
}
if ($gradeitem->is_course_item() || $gradeitem->is_category_item()) {
$gradecategory = $gradeitem->get_item_category();
$url = new moodle_url('/grade/edit/tree/category.php', ['id' => $gradecategory->id, 'courseid' => $courseid]);
redirect($this->gpr->add_url_params($url));
}
$item = $gradeitem->get_record_data();
$parentcategory = $gradeitem->get_parent_category();
} else {
$gradeitem = new grade_item(['courseid' => $courseid, 'itemtype' => 'manual'], false);
$item = $gradeitem->get_record_data();
$parentcategory = grade_category::fetch_course_category($courseid);
}
$item->parentcategory = $parentcategory->id;
$decimalpoints = $gradeitem->get_decimals();
if ($item->hidden > 1) {
$item->hiddenuntil = $item->hidden;
$item->hidden = 0;
} else {
$item->hiddenuntil = 0;
}
$item->locked = !empty($item->locked);
$item->grademax = format_float($item->grademax, $decimalpoints);
$item->grademin = format_float($item->grademin, $decimalpoints);
if ($parentcategory->aggregation == GRADE_AGGREGATE_SUM || $parentcategory->aggregation == GRADE_AGGREGATE_WEIGHTED_MEAN2) {
$item->aggregationcoef = $item->aggregationcoef == 0 ? 0 : 1;
} else {
$item->aggregationcoef = format_float($item->aggregationcoef, 4);
}
if ($parentcategory->aggregation == GRADE_AGGREGATE_SUM) {
$item->aggregationcoef2 = format_float($item->aggregationcoef2 * 100.0);
}
$item->cancontrolvisibility = $gradeitem->can_control_visibility();
return [
'gradeitem' => $gradeitem,
'item' => $item
];
}
/**
* Form definition
*
* @return void
* @throws \coding_exception
* @throws \dml_exception
* @throws \moodle_exception
*/
protected function definition() {
global $CFG;
$courseid = $this->optional_param('courseid', null, PARAM_INT);
$id = $this->optional_param('itemid', 0, PARAM_INT);
$gprplugin = $this->optional_param('gpr_plugin', '', PARAM_TEXT);
if ($gprplugin && ($gprplugin !== 'tree')) {
$this->gpr = new grade_plugin_return(['type' => 'report', 'plugin' => $gprplugin, 'courseid' => $courseid]);
} else {
$this->gpr = new grade_plugin_return(['type' => 'edit', 'plugin' => 'tree', 'courseid' => $courseid]);
}
$mform =& $this->_form;
$local = $this->get_gradeitem();
$gradeitem = $local['gradeitem'];
$item = $local['item'];
// Hidden elements.
$mform->addElement('hidden', 'id', 0);
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'courseid', $courseid);
$mform->setType('courseid', PARAM_INT);
$mform->addElement('hidden', 'itemid', $id);
$mform->setType('itemid', PARAM_INT);
$mform->addElement('hidden', 'itemtype', 'manual'); // All new items are manual only.
$mform->setType('itemtype', PARAM_ALPHA);
// Visible elements.
$mform->addElement('text', 'itemname', get_string('itemname', 'grades'));
$mform->setType('itemname', PARAM_TEXT);
if (!empty($item->id)) {
// If grades exist set a message so the user knows why they can not alter the grade type or scale.
// We could never change the grade type for external items, so only need to show this for manual grade items.
if ($gradeitem->has_grades() && !$gradeitem->is_external_item()) {
// Set a message so the user knows why they can not alter the grade type or scale.
if ($gradeitem->gradetype == GRADE_TYPE_SCALE) {
$gradesexistmsg = get_string('modgradecantchangegradetyporscalemsg', 'grades');
} else {
$gradesexistmsg = get_string('modgradecantchangegradetypemsg', 'grades');
}
$gradesexisthtml = '<div class=\'alert\'>' . $gradesexistmsg . '</div>';
$mform->addElement('static', 'gradesexistmsg', '', $gradesexisthtml);
}
}
// Manual grade items cannot have grade type GRADE_TYPE_NONE.
$mform->addElement('select', 'gradetype', get_string('gradetype', 'grades'), [
GRADE_TYPE_VALUE => get_string('typevalue', 'grades'),
GRADE_TYPE_SCALE => get_string('typescale', 'grades'),
GRADE_TYPE_TEXT => get_string('typetext', 'grades')
]);
$mform->addHelpButton('gradetype', 'gradetype', 'grades');
$mform->setDefault('gradetype', GRADE_TYPE_VALUE);
$options = [0 => get_string('usenoscale', 'grades')];
if ($scales = grade_scale::fetch_all_local($courseid)) {
foreach ($scales as $scale) {
$options[$scale->id] = $scale->get_name();
}
}
if ($scales = grade_scale::fetch_all_global()) {
foreach ($scales as $scale) {
$options[$scale->id] = $scale->get_name();
}
}
$mform->addElement('select', 'scaleid', get_string('scale'), $options);
$mform->addHelpButton('scaleid', 'typescale', 'grades');
$mform->hideIf('scaleid', 'gradetype', 'noteq', GRADE_TYPE_SCALE);
$mform->addElement('select', 'rescalegrades', get_string('modgraderescalegrades', 'grades'), [
'' => get_string('choose'),
'no' => get_string('no'),
'yes' => get_string('yes')
]);
$mform->addHelpButton('rescalegrades', 'modgraderescalegrades', 'grades');
$mform->hideIf('rescalegrades', 'gradetype', 'noteq', GRADE_TYPE_VALUE);
$mform->addElement('float', 'grademax', get_string('grademax', 'grades'));
$mform->addHelpButton('grademax', 'grademax', 'grades');
$mform->hideIf('grademax', 'gradetype', 'noteq', GRADE_TYPE_VALUE);
if (get_config('moodle', 'grade_report_showmin')) {
$mform->addElement('float', 'grademin', get_string('grademin', 'grades'));
$mform->addHelpButton('grademin', 'grademin', 'grades');
$mform->hideIf('grademin', 'gradetype', 'noteq', GRADE_TYPE_VALUE);
}
// Hiding.
if ($item->cancontrolvisibility) {
$mform->addElement('advcheckbox', 'hidden', get_string('hidden', 'grades'), '', [], [0, 1]);
$mform->hideIf('hidden', 'hiddenuntil[enabled]', 'checked');
} else {
$mform->addElement('static', 'hidden', get_string('hidden', 'grades'),
get_string('componentcontrolsvisibility', 'grades'));
// Unset hidden to avoid data override.
unset($item->hidden);
}
$mform->addHelpButton('hidden', 'hidden', 'grades');
// Locking.
$mform->addElement('advcheckbox', 'locked', get_string('locked', 'grades'));
$mform->addHelpButton('locked', 'locked', 'grades');
// Weight overrides.
$mform->addElement('advcheckbox', 'weightoverride', get_string('adjustedweight', 'grades'));
$mform->addHelpButton('weightoverride', 'weightoverride', 'grades');
$mform->hideIf('weightoverride', 'gradetype', 'eq', GRADE_TYPE_NONE);
$mform->hideIf('weightoverride', 'gradetype', 'eq', GRADE_TYPE_TEXT);
// Parent category related settings.
$mform->addElement('float', 'aggregationcoef2', get_string('weight', 'grades'));
$mform->addHelpButton('aggregationcoef2', 'weight', 'grades');
$mform->hideIf('aggregationcoef2', 'weightoverride');
$mform->hideIf('aggregationcoef2', 'gradetype', 'eq', GRADE_TYPE_NONE);
$mform->hideIf('aggregationcoef2', 'gradetype', 'eq', GRADE_TYPE_TEXT);
$options = [];
$categories = grade_category::fetch_all(['courseid' => $courseid]);
foreach ($categories as $cat) {
$cat->apply_forced_settings();
$options[$cat->id] = $cat->get_name();
}
if (count($categories) > 1) {
$mform->addElement('select', 'parentcategory', get_string('gradecategory', 'grades'), $options);
}
$parentcategory = $gradeitem->get_parent_category();
if (!$parentcategory) {
// If we do not have an id, we are creating a new grade item.
// Assign the course category to this grade item.
$parentcategory = grade_category::fetch_course_category($courseid);
$gradeitem->parent_category = $parentcategory;
}
if ($gradeitem->is_outcome_item()) {
// We have to prevent incompatible modifications of outcomes if outcomes disabled.
$mform->removeElement('grademax');
if ($mform->elementExists('grademin')) {
$mform->removeElement('grademin');
}
$mform->removeElement('gradetype');
$mform->hardFreeze('scaleid');
} else {
if ($gradeitem->is_external_item()) {
// Following items are set up from modules and should not be overrided by user.
if ($mform->elementExists('grademin')) {
// The site setting grade_report_showmin may have prevented grademin being added to the form.
$mform->hardFreeze('grademin');
}
$mform->hardFreeze('itemname,gradetype,grademax,scaleid');
// For external items we can not change the grade type, even if no grades exist, so if it is set to
// scale, then remove the grademax and grademin fields from the form - no point displaying them.
if ($gradeitem->gradetype == GRADE_TYPE_SCALE) {
$mform->removeElement('grademax');
if ($mform->elementExists('grademin')) {
$mform->removeElement('grademin');
}
} else { // Not using scale, so remove it.
$mform->removeElement('scaleid');
}
// Always remove the rescale grades element if it's an external item.
$mform->removeElement('rescalegrades');
} else if ($gradeitem->has_grades()) {
// Can't change the grade type or the scale if there are grades.
$mform->hardFreeze('gradetype, scaleid');
// If we are using scales then remove the unnecessary rescale and grade fields.
if ($gradeitem->gradetype == GRADE_TYPE_SCALE) {
$mform->removeElement('rescalegrades');
$mform->removeElement('grademax');
if ($mform->elementExists('grademin')) {
$mform->removeElement('grademin');
}
} else { // Remove the scale field.
$mform->removeElement('scaleid');
// Set the maximum grade to disabled unless a grade is chosen.
$mform->hideIf('grademax', 'rescalegrades', 'eq', '');
}
} else {
// Remove rescale element if there are no grades.
$mform->removeElement('rescalegrades');
}
}
// If we wanted to change parent of existing item - we would have to verify there are no circular references in parents!!!
if ($id > -1 && $mform->elementExists('parentcategory')) {
$mform->hardFreeze('parentcategory');
}
$parentcategory->apply_forced_settings();
if (!$parentcategory->is_aggregationcoef_used()) {
if ($mform->elementExists('aggregationcoef')) {
$mform->removeElement('aggregationcoef');
}
} else {
$coefstring = $gradeitem->get_coefstring();
if ($coefstring !== '') {
if ($coefstring == 'aggregationcoefextrasum' || $coefstring == 'aggregationcoefextraweightsum') {
// The advcheckbox is not compatible with disabledIf!
$coefstring = 'aggregationcoefextrasum';
$element =& $mform->createElement('checkbox', 'aggregationcoef', get_string($coefstring, 'grades'));
} else {
$element =& $mform->createElement('text', 'aggregationcoef', get_string($coefstring, 'grades'));
}
if ($mform->elementExists('parentcategory')) {
$mform->insertElementBefore($element, 'parentcategory');
} else {
$mform->insertElementBefore($element, 'aggregationcoef2');
}
$mform->addHelpButton('aggregationcoef', $coefstring, 'grades');
}
$mform->hideIf('aggregationcoef', 'gradetype', 'eq', GRADE_TYPE_NONE);
$mform->hideIf('aggregationcoef', 'gradetype', 'eq', GRADE_TYPE_TEXT);
$mform->hideIf('aggregationcoef', 'parentcategory', 'eq', $parentcategory->id);
}
// Remove fields used by natural weighting if the parent category is not using natural weighting.
// Or if the item is a scale and scales are not used in aggregation.
if ($parentcategory->aggregation != GRADE_AGGREGATE_SUM
|| (empty($CFG->grade_includescalesinaggregation) && $gradeitem->gradetype == GRADE_TYPE_SCALE)) {
if ($mform->elementExists('weightoverride')) {
$mform->removeElement('weightoverride');
}
if ($mform->elementExists('aggregationcoef2')) {
$mform->removeElement('aggregationcoef2');
}
}
if ($category = $gradeitem->get_item_category()) {
if ($category->aggregation == GRADE_AGGREGATE_SUM) {
if ($mform->elementExists('gradetype')) {
$mform->hardFreeze('gradetype');
}
if ($mform->elementExists('grademin')) {
$mform->hardFreeze('grademin');
}
if ($mform->elementExists('grademax')) {
$mform->hardFreeze('grademax');
}
if ($mform->elementExists('scaleid')) {
$mform->removeElement('scaleid');
}
}
}
$url = new moodle_url('/grade/edit/tree/item.php', ['id' => $id, 'courseid' => $courseid]);
$url = $this->gpr->add_url_params($url);
$url = '<a href="' . $url . '">' . get_string('showmore', 'form') .'</a>';
$mform->addElement('static', 'advancedform', $url);
// Add return tracking info.
$this->gpr->add_mform_elements($mform);
$this->set_data($item);
}
/**
* Return form context
*
* @return context
*/
protected function get_context_for_dynamic_submission(): context {
$courseid = $this->optional_param('courseid', null, PARAM_INT);
return context_course::instance($courseid);
}
/**
* Check if current user has access to this form, otherwise throw exception
*
* @return void
* @throws \required_capability_exception
*/
protected function check_access_for_dynamic_submission(): void {
$courseid = $this->optional_param('courseid', null, PARAM_INT);
require_capability('moodle/grade:manage', context_course::instance($courseid));
}
/**
* Load in existing data as form defaults
*
* @return void
*/
public function set_data_for_dynamic_submission(): void {
$this->set_data((object)[
'courseid' => $this->optional_param('courseid', null, PARAM_INT),
'itemid' => $this->optional_param('itemid', null, PARAM_INT)
]);
}
/**
* Returns url to set in $PAGE->set_url() when form is being rendered or submitted via AJAX
*
* @return moodle_url
* @throws \moodle_exception
*/
protected function get_page_url_for_dynamic_submission(): moodle_url {
$params = [
'id' => $this->optional_param('courseid', null, PARAM_INT),
'itemid' => $this->optional_param('itemid', null, PARAM_INT),
];
return new moodle_url('/grade/edit/tree/index.php', $params);
}
/**
* Process the form submission, used if form was submitted via AJAX
*
* @return array
* @throws \moodle_exception
*/
public function process_dynamic_submission() {
$data = $this->get_data();
$url = $this->gpr->get_return_url('index.php?id=' . $data->courseid);
$local = $this->get_gradeitem();
$gradeitem = $local['gradeitem'];
$item = $local['item'];
$parentcategory = grade_category::fetch_course_category($data->courseid);
// Form submission handling.
// This is a new item, and the category chosen is different than the default category.
if (empty($gradeitem->id) && isset($data->parentcategory) && $parentcategory->id != $data->parentcategory) {
$parentcategory = grade_category::fetch(['id' => $data->parentcategory]);
}
// If unset, give the aggregation values a default based on parent aggregation method.
$defaults = grade_category::get_default_aggregation_coefficient_values($parentcategory->aggregation);
if (!isset($data->aggregationcoef) || $data->aggregationcoef == '') {
$data->aggregationcoef = $defaults['aggregationcoef'];
}
if (!isset($data->weightoverride)) {
$data->weightoverride = $defaults['weightoverride'];
}
if (!isset($data->gradepass) || $data->gradepass == '') {
$data->gradepass = 0;
}
if (!isset($data->grademin) || $data->grademin == '') {
$data->grademin = 0;
}
$hide = empty($data->hiddenuntil) ? 0 : $data->hiddenuntil;
if (!$hide) {
$hide = empty($data->hidden) ? 0 : $data->hidden;
}
$locked = empty($data->locked) ? 0 : $data->locked;
$locktime = empty($data->locktime) ? 0 : $data->locktime;
$convert = ['grademax', 'grademin', 'aggregationcoef', 'aggregationcoef2'];
foreach ($convert as $param) {
if (property_exists($data, $param)) {
$data->$param = unformat_float($data->$param);
}
}
if (isset($data->aggregationcoef2) && $parentcategory->aggregation == GRADE_AGGREGATE_SUM) {
$data->aggregationcoef2 = $data->aggregationcoef2 / 100.0;
} else {
$data->aggregationcoef2 = $defaults['aggregationcoef2'];
}
$oldmin = $gradeitem->grademin;
$oldmax = $gradeitem->grademax;
grade_item::set_properties($gradeitem, $data);
$gradeitem->outcomeid = null;
// Handle null decimals value.
if (!property_exists($data, 'decimals') || $data->decimals < 0) {
$gradeitem->decimals = null;
}
if (empty($gradeitem->id)) {
$gradeitem->itemtype = 'manual'; // All new items to be manual only.
$gradeitem->insert();
// Set parent if needed.
if (isset($data->parentcategory)) {
$gradeitem->set_parent($data->parentcategory, false);
}
} else {
$gradeitem->update();
if (!empty($data->rescalegrades) && $data->rescalegrades == 'yes') {
$newmin = $gradeitem->grademin;
$newmax = $gradeitem->grademax;
$gradeitem->rescale_grades_keep_percentage($oldmin, $oldmax, $newmin, $newmax, 'gradebook');
}
}
if ($item->cancontrolvisibility) {
// Update hiding flag.
$gradeitem->set_hidden($hide, true);
}
$gradeitem->set_locktime($locktime); // Locktime first - it might be removed when unlocking.
$gradeitem->set_locked($locked);
return [
'result' => true,
'url' => $url,
'errors' => [],
];
}
/**
* Form validation.
*
* @param array $data array of ("fieldname"=>value) of submitted data
* @param array $files array of uploaded files "element_name"=>tmp_file_path
* @return array of "element_name"=>"error_description" if there are errors,
* or an empty array if everything is OK (true allowed for backwards compatibility too).
*/
public function validation($data, $files): array {
$errors = [];
$local = $this->get_gradeitem();
$gradeitem = $local['gradeitem'];
if (isset($data['gradetype']) && $data['gradetype'] == GRADE_TYPE_SCALE) {
if (empty($data['scaleid'])) {
$errors['scaleid'] = get_string('missingscale', 'grades');
}
}
// We need to make all the validations related with grademax and grademin
// with them being correct floats, keeping the originals unmodified for
// later validations / showing the form back...
// TODO: Note that once MDL-73994 is fixed we'll have to re-visit this and
// adapt the code below to the new values arriving here, without forgetting
// the special case of empties and nulls.
$grademax = isset($data['grademax']) ? unformat_float($data['grademax']) : null;
$grademin = isset($data['grademin']) ? unformat_float($data['grademin']) : null;
if (!is_null($grademin) && !is_null($grademax)) {
if ($grademax == $grademin || $grademax < $grademin) {
$errors['grademin'] = get_string('incorrectminmax', 'grades');
$errors['grademax'] = get_string('incorrectminmax', 'grades');
}
}
// We do not want the user to be able to change the grade type or scale for this item if grades exist.
if ($gradeitem && $gradeitem->has_grades()) {
// Check that grade type is set - should never not be set unless form has been modified.
if (!isset($data['gradetype'])) {
$errors['gradetype'] = get_string('modgradecantchangegradetype', 'grades');
} else if ($data['gradetype'] !== $gradeitem->gradetype) { // Check if we are changing the grade type.
$errors['gradetype'] = get_string('modgradecantchangegradetype', 'grades');
} else if ($data['gradetype'] == GRADE_TYPE_SCALE) {
// Check if we are changing the scale - can't do this when grades exist.
if (isset($data['scaleid']) && ($data['scaleid'] !== $gradeitem->scaleid)) {
$errors['scaleid'] = get_string('modgradecantchangescale', 'grades');
}
}
}
if ($gradeitem) {
if ($gradeitem->gradetype == GRADE_TYPE_VALUE) {
if ((((bool) get_config('moodle', 'grade_report_showmin')) &&
grade_floats_different($grademin, $gradeitem->grademin)) ||
grade_floats_different($grademax, $gradeitem->grademax)) {
if ($gradeitem->has_grades() && empty($data['rescalegrades'])) {
$errors['rescalegrades'] = get_string('mustchooserescaleyesorno', 'grades');
}
}
}
}
return $errors;
}
}

View file

@ -17,6 +17,7 @@
namespace core_grades\output; namespace core_grades\output;
use moodle_url; use moodle_url;
use html_writer;
/** /**
* Renderable class for the action bar elements in the gradebook setup pages. * Renderable class for the action bar elements in the gradebook setup pages.
@ -55,8 +56,20 @@ class gradebook_setup_action_bar extends action_bar {
$data = $generalnavselector->export_for_template($output); $data = $generalnavselector->export_for_template($output);
// Add a button to the action bar with a link to the 'add grade item' page. // Add a button to the action bar with a link to the 'add grade item' page.
$addgradeitemlink = new moodle_url('/grade/edit/tree/item.php', ['courseid' => $courseid]); $addgradeitemlink = new moodle_url('#');
$addgradeitembutton = new \single_button($addgradeitemlink, get_string('additem', 'grades'), 'get'); $addgradeitembutton = new \single_button(
$addgradeitemlink,
get_string('additem', 'grades'),
'get',
\single_button::BUTTON_SECONDARY,
[
'class' => 'btn btn-secondary',
'data-courseid' => $courseid,
'data-itemid' => -1,
'data-trigger' => 'add-item-form',
'data-gprplugin' => 'tree'
]
);
$data['addgradeitembutton'] = $addgradeitembutton->export_for_template($output); $data['addgradeitembutton'] = $addgradeitembutton->export_for_template($output);
// If outcomes are enabled, add a button to the action bar with a link to the 'add outcome item' page. // If outcomes are enabled, add a button to the action bar with a link to the 'add outcome item' page.

View file

@ -48,6 +48,7 @@ $context = context_course::instance($course->id);
require_capability('moodle/grade:manage', $context); require_capability('moodle/grade:manage', $context);
$PAGE->requires->js_call_amd('core_grades/edittree_index', 'init', [$courseid, $USER->id]); $PAGE->requires->js_call_amd('core_grades/edittree_index', 'init', [$courseid, $USER->id]);
$PAGE->requires->js_call_amd('core_grades/gradebooksetup_forms', 'init');
/// return tracking object /// return tracking object
$gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'tree', 'courseid'=>$courseid)); $gpr = new grade_plugin_return(array('type'=>'edit', 'plugin'=>'tree', 'courseid'=>$courseid));

View file

@ -127,13 +127,11 @@ class edit_item_form extends moodleform {
$mform->addElement('float', 'multfactor', get_string('multfactor', 'grades')); $mform->addElement('float', 'multfactor', get_string('multfactor', 'grades'));
$mform->addHelpButton('multfactor', 'multfactor', 'grades'); $mform->addHelpButton('multfactor', 'multfactor', 'grades');
$mform->setAdvanced('multfactor');
$mform->disabledIf('multfactor', 'gradetype', 'eq', GRADE_TYPE_NONE); $mform->disabledIf('multfactor', 'gradetype', 'eq', GRADE_TYPE_NONE);
$mform->disabledIf('multfactor', 'gradetype', 'eq', GRADE_TYPE_TEXT); $mform->disabledIf('multfactor', 'gradetype', 'eq', GRADE_TYPE_TEXT);
$mform->addElement('float', 'plusfactor', get_string('plusfactor', 'grades')); $mform->addElement('float', 'plusfactor', get_string('plusfactor', 'grades'));
$mform->addHelpButton('plusfactor', 'plusfactor', 'grades'); $mform->addHelpButton('plusfactor', 'plusfactor', 'grades');
$mform->setAdvanced('plusfactor');
$mform->disabledIf('plusfactor', 'gradetype', 'eq', GRADE_TYPE_NONE); $mform->disabledIf('plusfactor', 'gradetype', 'eq', GRADE_TYPE_NONE);
$mform->disabledIf('plusfactor', 'gradetype', 'eq', GRADE_TYPE_TEXT); $mform->disabledIf('plusfactor', 'gradetype', 'eq', GRADE_TYPE_TEXT);
@ -234,16 +232,6 @@ class edit_item_form extends moodleform {
/// add return tracking info /// add return tracking info
$gpr = $this->_customdata['gpr']; $gpr = $this->_customdata['gpr'];
$gpr->add_mform_elements($mform); $gpr->add_mform_elements($mform);
/// mark advanced according to site settings
if (isset($CFG->grade_item_advanced)) {
$advanced = explode(',', $CFG->grade_item_advanced);
foreach ($advanced as $el) {
if ($mform->elementExists($el)) {
$mform->setAdvanced($el);
}
}
}
//------------------------------------------------------------------------------- //-------------------------------------------------------------------------------
// buttons // buttons
$this->add_action_buttons(); $this->add_action_buttons();

View file

@ -2061,6 +2061,8 @@ class grade_structure {
* @return string|null * @return string|null
*/ */
public function get_edit_link(array $element, object $gpr): ?string { public function get_edit_link(array $element, object $gpr): ?string {
global $CFG;
$url = null; $url = null;
$title = ''; $title = '';
if ((!has_capability('moodle/grade:manage', $this->context) && if ((!has_capability('moodle/grade:manage', $this->context) &&
@ -2083,8 +2085,15 @@ class grade_structure {
} else if (($element['type'] == 'item') || ($element['type'] == 'categoryitem') || } else if (($element['type'] == 'item') || ($element['type'] == 'categoryitem') ||
($element['type'] == 'courseitem')) { ($element['type'] == 'courseitem')) {
if (empty($object->outcomeid) || empty($CFG->enableoutcomes)) { if (empty($object->outcomeid) || empty($CFG->enableoutcomes)) {
$url = new moodle_url('/grade/edit/tree/item.php', $url = new moodle_url('#');
['courseid' => $this->courseid, 'id' => $object->id]); return html_writer::link($url, get_string('itemsedit', 'grades'), [
'class' => 'dropdown-item',
'aria-label' => get_string('itemsedit', 'grades'),
'role' => 'menuitem',
'data-gprplugin' => $gpr->plugin,
'data-courseid' => $this->courseid,
'data-itemid' => $object->id, 'data-trigger' => 'add-item-form'
]);
} else { } else {
$url = new moodle_url('/grade/edit/tree/outcomeitem.php', $url = new moodle_url('/grade/edit/tree/outcomeitem.php',
['courseid' => $this->courseid, 'id' => $object->id]); ['courseid' => $this->courseid, 'id' => $object->id]);

View file

@ -51,6 +51,7 @@ $PAGE->set_pagelayout('report');
$PAGE->requires->js_call_amd('gradereport_grader/stickycolspan', 'init'); $PAGE->requires->js_call_amd('gradereport_grader/stickycolspan', 'init');
$PAGE->requires->js_call_amd('gradereport_grader/search', 'init'); $PAGE->requires->js_call_amd('gradereport_grader/search', 'init');
$PAGE->requires->js_call_amd('gradereport_grader/feedback_modal', 'init'); $PAGE->requires->js_call_amd('gradereport_grader/feedback_modal', 'init');
$PAGE->requires->js_call_amd('core_grades/gradebooksetup_forms', 'init');
// basic access checks // basic access checks
if (!$course = $DB->get_record('course', array('id' => $courseid))) { if (!$course = $DB->get_record('course', array('id' => $courseid))) {

View file

@ -72,9 +72,15 @@ class behat_grade extends behat_base {
} }
$this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $linktext); $this->execute("behat_action_menu::i_choose_in_the_open_action_menu", $linktext);
$savechanges = get_string('savechanges', 'grades');
$this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data); $this->execute("behat_forms::i_set_the_following_fields_to_these_values", $data);
$this->execute('behat_forms::press_button', $this->escape($savechanges)); if ($this->getSession()->getPage()->find('xpath', './/button[@data-action="save"]')) {
$container = $this->get_selected_node("core_grades > gradeitem modal", "form");
$node = $this->find('xpath', './/button[@data-action="save"]', false, $container);
$node->press();
} else {
$savechanges = get_string('savechanges', 'grades');
$this->execute('behat_forms::press_button', $this->escape($savechanges));
}
} }
/** /**

View file

@ -42,6 +42,10 @@ class behat_grades extends behat_base {
'grade_actions', 'grade_actions',
["//td[count(//table[@id='user-grades']//th[contains(., %locator%)]/preceding-sibling::th)]//*[@data-type='grade']"] ["//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 ')]"]
),
]; ];
} }
@ -56,8 +60,13 @@ class behat_grades extends behat_base {
public function i_select_in_the($value, $element, $selectortype) { public function i_select_in_the($value, $element, $selectortype) {
// Getting the container where the text should be found. // Getting the container where the text should be found.
$container = $this->get_selected_node($selectortype, $element); $container = $this->get_selected_node($selectortype, $element);
$node = $this->find('xpath', './/input[@value="' . $value . '"]', false, $container); if ($this->getSession()->getPage()->find('xpath', './/input[@value="' . $value . '"]')) {
$node->click(); $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();
}
} }
/** /**

View file

@ -27,6 +27,7 @@ Feature: Site settings can be used to hide parts of the gradebook UI
Given I click on grade item menu "Assignment1" of type "gradeitem" on "grader" page 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 When I choose "Edit grade item" in the open action menu
And I should see "Minimum grade" 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 Then I navigate to "Grades > General settings" in site administration
And I set the field "Show minimum grade" to "0" And I set the field "Show minimum grade" to "0"
And I press "Save changes" And I press "Save changes"

View file

@ -266,7 +266,7 @@ Feature: We can use calculated grade totals
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I navigate to "Setup > Gradebook setup" in the course gradebook And I navigate to "Setup > Gradebook setup" in the course gradebook
And I set the following settings for grade item "Test outcome item one" of type "gradeitem" on "setup" page: And I set the following settings for grade item "Test outcome item one" of type "gradeitem" on "setup" page:
| Extra credit | 1 | | aggregationcoef | 1 |
And I log out And I log out
And I log in as "student1" And I log in as "student1"
And I follow "Grades" in the user menu And I follow "Grades" in the user menu
@ -280,6 +280,7 @@ Feature: We can use calculated grade totals
And I set the following settings for grade item "Course 1" of type "course" on "setup" page: And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural | | Aggregation | Natural |
| Include outcomes in aggregation | 0 | | Include outcomes in aggregation | 0 |
And I press "Save"
And I log out And I log out
And I log in as "student1" And I log in as "student1"
And I follow "Grades" in the user menu And I follow "Grades" in the user menu
@ -402,17 +403,17 @@ Feature: We can use calculated grade totals
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 1 | | Item name | Manual item 1 |
| Grade category | Sub category 3 | | Grade category | Sub category 3 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 2 | | Item name | Manual item 2 |
| Grade category | Sub category 3 | | Grade category | Sub category 3 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 3 | | Item name | Manual item 3 |
| Grade category | Sub category 3 | | Grade category | Sub category 3 |
And I press "Save changes" 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 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 "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 "20.00" to the user "Student 1" for the grade item "Manual item 2"

View file

@ -62,46 +62,46 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1" And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0" And the field "Weight" matches value "40.0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1" And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0" And the field "Weight" matches value "10.0"
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1" And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0" And the field "Weight" matches value "40.0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1" And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0" And the field "Weight" matches value "10.0"
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" 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 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 Given I click on grade item menu "Course 1" of type "course" on "grader" page
@ -113,25 +113,25 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
Then I should not see "Weight adjusted" Then I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" 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 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 choose "Edit category" in the open action menu
And I expand all fieldsets And I expand all fieldsets
@ -162,25 +162,25 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Weight" And I should not see "Weight"
And I should not see "Extra credit" And I should not see "Extra credit"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Switching back. # Switching back.
And I click on grade item menu "Course 1" of type "course" on "grader" page 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 choose "Edit category" in the open action menu
@ -190,22 +190,22 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit category" in the open action menu
And I expand all fieldsets And I expand all fieldsets
@ -232,22 +232,22 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 Given I click on grade item menu "Course 1" of type "course" on "grader" page
@ -259,25 +259,25 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
Then I should not see "Weight adjusted" Then I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" 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 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 choose "Edit category" in the open action menu
And I expand all fieldsets And I expand all fieldsets
@ -308,25 +308,25 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And I should not see "Weight adjusted" And I should not see "Weight adjusted"
And I should not see "Extra credit" And I should not see "Extra credit"
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Switching back. # Switching back.
And I click on grade item menu "Course 1" of type "course" on "grader" page 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 choose "Edit category" in the open action menu
@ -336,22 +336,22 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit category" in the open action menu
And I expand all fieldsets And I expand all fieldsets
@ -378,22 +378,22 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
Scenario: Switching grade items between categories Scenario: Switching grade items between categories
# Move to same aggregation (Natural). # Move to same aggregation (Natural).
@ -409,24 +409,24 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
Then the field "Weight adjusted" matches value "0" Then the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1" And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "40.0" And the field "Weight" matches value "40.0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "1" And the field "Weight adjusted" matches value "1"
And the field "id_aggregationcoef2" matches value "10.0" And the field "Weight" matches value "10.0"
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Move to Mean of grades (with extra credit). # Move to Mean of grades (with extra credit).
And I navigate to "Setup > Gradebook setup" in the course gradebook 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 a1" to "1"
@ -438,19 +438,19 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page 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 I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Move to Simple weight mean of grades. # Move to Simple weight mean of grades.
And I navigate to "Setup > Gradebook setup" in the course gradebook 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 a1" to "1"
@ -462,19 +462,19 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page 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 I choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Extra credit" matches value "1" And the field "Extra credit" matches value "1"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"
# Move to Weighted mean of grades. # Move to Weighted mean of grades.
And I navigate to "Setup > Gradebook setup" in the course gradebook 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 a1" to "1"
@ -487,22 +487,22 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I set the field "Item weight" to "2" And I set the field "Item weight" to "2"
And I press "Save changes" 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 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 choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I set the field "Item weight" to "5" And I set the field "Item weight" to "5"
And I press "Save changes" 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 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 choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I set the field "Item weight" to "8" And I set the field "Item weight" to "8"
And I press "Save changes" 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 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 choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "1" And the field "Item weight" matches value "1"
And I set the field "Item weight" to "11" And I set the field "Item weight" to "11"
And I press "Save changes" And I click on "Save" "button" in the "Edit grade item" "dialogue"
# Move to same (Weighted mean of grades). # Move to same (Weighted mean of grades).
And I navigate to "Setup > Gradebook setup" in the course gradebook 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 a1" to "1"
@ -515,19 +515,19 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I click on grade item menu "Item a1" of type "gradeitem" on "grader" page 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 I choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "2" And the field "Item weight" matches value "2"
And I press "Save changes" 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 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 choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "5" And the field "Item weight" matches value "5"
And I press "Save changes" 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 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 choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "8" And the field "Item weight" matches value "8"
And I press "Save changes" 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 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 choose "Edit grade item" in the open action menu
And the field "Item weight" matches value "11" And the field "Item weight" matches value "11"
And I press "Save changes" And I click on "Save" "button" in the "Edit grade item" "dialogue"
# Move back to Natural. # Move back to Natural.
And I navigate to "Setup > Gradebook setup" in the course gradebook 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 a1" to "1"
@ -540,19 +540,19 @@ Feature: Changing the aggregation of an item affects its weight and extra credit
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" 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 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 choose "Edit grade item" in the open action menu
And the field "Weight adjusted" matches value "0" And the field "Weight adjusted" matches value "0"
And the field "Extra credit" matches value "0" And the field "Extra credit" matches value "0"
And I press "Cancel" And I click on "Cancel" "button" in the "Edit grade item" "dialogue"

View file

@ -32,7 +32,7 @@ Feature: Average grades are displayed in the gradebook
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 1 | | Item name | Manual item 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
# Give all student the same grade for the manual grade item # Give all student the same grade for the manual grade item
And I navigate to "View > Grader report" in the course gradebook And I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on And I turn editing mode on

View file

@ -32,7 +32,7 @@ Feature: Calculated grade items can be used in the gradebook
And I set the following fields to these values: And I set the following fields to these values:
| Item name | grade item 1 | | Item name | grade item 1 |
| Grade category | Calc cat | | Grade category | Calc cat |
And I press "Save changes" 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: And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 | | grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page: And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
@ -59,7 +59,7 @@ Feature: Calculated grade items can be used in the gradebook
And I set the following fields to these values: And I set the following fields to these values:
| Item name | grade item 1 | | Item name | grade item 1 |
| Grade category | Calc cat | | Grade category | Calc cat |
And I press "Save changes" 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: And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 | | grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page: And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
@ -117,11 +117,11 @@ Feature: Calculated grade items can be used in the gradebook
Given I press "Add grade item" Given I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | grade item 1 | | Item name | grade item 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | calc item | | Item name | calc item |
And I press "Save changes" 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: And I set "=[[gi1]]/2" calculation for grade item "calc item" with idnumbers:
| grade item 1 | gi1 | | grade item 1 | gi1 |
And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page: And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page:

View file

@ -33,7 +33,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
And I set the following fields to these values: And I set the following fields to these values:
| Item name | grade item 1 | | Item name | grade item 1 |
| Grade category | Calc cat | | Grade category | Calc cat |
And I press "Save changes" 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: And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 | | grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page: And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
@ -60,7 +60,7 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
And I set the following fields to these values: And I set the following fields to these values:
| Item name | grade item 1 | | Item name | grade item 1 |
| Grade category | Calc cat | | Grade category | Calc cat |
And I press "Save changes" 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: And I set "=[[gi1]]/2" calculation for grade category "Calc cat" with idnumbers:
| grade item 1 | gi1 | | grade item 1 | gi1 |
And I set the following settings for grade item "Calc cat" of type "category" on "setup" page: And I set the following settings for grade item "Calc cat" of type "category" on "setup" page:
@ -118,11 +118,11 @@ Feature: Gradebook calculations for calculated grade items before the fix 201506
Given I press "Add grade item" Given I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | grade item 1 | | Item name | grade item 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | calc item | | Item name | calc item |
And I press "Save changes" 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: And I set "=[[gi1]]/2" calculation for grade item "calc item" with idnumbers:
| grade item 1 | gi1 | | grade item 1 | gi1 |
And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page: And I set the following settings for grade item "calc item" of type "gradeitem" on "setup" page:

View file

@ -207,12 +207,13 @@ Feature: We can understand the gradebook user report
@javascript @skip_chrome_zerosize @javascript @skip_chrome_zerosize
Scenario: View user report with mixed aggregation methods 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: And I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | Natural | | Aggregation | Natural |
And I set the following settings for grade item "Sub category" of type "category" on "setup" page: And I set the following settings for grade item "Sub category" of type "category" on "setup" page:
| Aggregation | Weighted mean of grades | | Aggregation | Weighted mean of grades |
And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page: And I set the following settings for grade item "Test assignment three" of type "gradeitem" on "setup" page:
| Extra credit | 1 | | aggregationcoef | 1 |
And I navigate to "View > User report" in the course gradebook And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget And I click on "Student 1" in the "user" search widget

View file

@ -43,12 +43,12 @@ Feature: Editing a grade item
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Item 1 | | Item name | Item 1 |
| Grade category | Cat 1 | | Grade category | Cat 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Item 2 | | Item name | Item 2 |
| Grade category | Cat 1 | | Grade category | Cat 1 |
And I press "Save changes" 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 grade category when there are no overridden grades 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 Given I click on grade item menu "Cat 1" of type "category" on "setup" page

View file

@ -25,19 +25,19 @@ Feature: Extra credit contributions are normalised when going out of bounds
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 1 | | Item name | Manual item 1 |
| Maximum grade | 150 | | Maximum grade | 150 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 2 | | Item name | Manual item 2 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 3 | | Item name | Manual item 3 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 4 | | Item name | Manual item 4 |
And I press "Save changes" 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 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 weighting" to "Show"
And I set the field "Show contribution to course total" to "Show" And I set the field "Show contribution to course total" to "Show"
@ -58,11 +58,11 @@ Feature: Extra credit contributions are normalised when going out of bounds
When I set the following settings for grade item "Course 1" of type "course" on "setup" page: When I set the following settings for grade item "Course 1" of type "course" on "setup" page:
| Aggregation | <aggregation> | | Aggregation | <aggregation> |
And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "setup" page: And I set the following settings for grade item "Manual item 2" of type "gradeitem" on "setup" page:
| Extra credit | 1 | | aggregationcoef | 1 |
And I set the following settings for grade item "Manual item 3" of type "gradeitem" on "setup" page: And I set the following settings for grade item "Manual item 3" of type "gradeitem" on "setup" page:
| Extra credit | 1 | | aggregationcoef | 1 |
And I set the following settings for grade item "Manual item 4" of type "gradeitem" on "setup" page: And I set the following settings for grade item "Manual item 4" of type "gradeitem" on "setup" page:
| Extra credit | 1 | | aggregationcoef | 1 |
And I navigate to "View > User report" in the course gradebook And I navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget And I click on "Student 1" in the "user" search widget
Then the following should exist in the "user-grade" table: Then the following should exist in the "user-grade" table:

View file

@ -27,7 +27,7 @@ Feature: We can change the maximum and minimum number of points for manual items
| Item name | Manual item 1 | | Item name | Manual item 1 |
| Minimum grade | 0 | | Minimum grade | 0 |
| Maximum grade | 100 | | Maximum grade | 100 |
And I press "Save changes" 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 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 weightings" to "Show"
And I set the field "Show contribution to course total" to "Show" And I set the field "Show contribution to course total" to "Show"
@ -59,7 +59,7 @@ Feature: We can change the maximum and minimum number of points for manual items
And I set the following fields to these values: And I set the following fields to these values:
| Rescale existing grades | Yes | | Rescale existing grades | Yes |
| Maximum grade | 20 | | Maximum grade | 20 |
And I press "Save changes" 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 navigate to "View > User report" in the course gradebook
And I click on "Student 1" in the "user" search widget And I click on "Student 1" in the "user" search widget
And the following should exist in the "user-grade" table: And the following should exist in the "user-grade" table:

View file

@ -32,7 +32,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | calculated | | Item name | calculated |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I set "=[[a4]]/2" calculation for grade item "calculated" with idnumbers: And I set "=[[a4]]/2" calculation for grade item "calculated" with idnumbers:
| Sub category 1 | sub1 | | Sub category 1 | sub1 |
And I navigate to "Grades > Report settings > Overview report" in site administration And I navigate to "Grades > Report settings > Overview report" in site administration

View file

@ -29,7 +29,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
| Item name | Hidden item | | Item name | Hidden item |
| Hidden | 1 | | Hidden | 1 |
| Grade category | Test locked category | | Grade category | Test locked category |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I log out And I log out
And I log in as "teacher1" And I log in as "teacher1"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
@ -75,7 +75,7 @@ Feature: Hidden grade items should be hidden when grade category is locked, but
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Cat b item | | Item name | Cat b item |
| Grade category | Test overridden category B | | Grade category | Test overridden category B |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
When I navigate to "View > Grader report" in the course gradebook When I navigate to "View > Grader report" in the course gradebook
And I turn editing mode on 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 give the grade "50.00" to the user "Student 1" for the grade item "Test overridden category B total"

View file

@ -34,6 +34,7 @@ Feature: We can duplicate grade items that already exist.
Then I should see "Item1 (copy)" Then I should see "Item1 (copy)"
And I click on grade item menu "Item1 (copy)" of type "gradeitem" on "setup" page 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 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 "Item name" matches value "Item1 (copy)"
And the field "ID number" matches value "" And the field "ID number" matches value ""
And the field "Grade type" matches value "Value" And the field "Grade type" matches value "Value"

View file

@ -51,7 +51,7 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
And the field "Hidden" matches value "1" And the field "Hidden" matches value "1"
And I set the field "Hidden" to "0" And I set the field "Hidden" to "0"
And I press "Save changes" And I click on "Save" "button" in the "Edit grade item" "dialogue"
And I log out And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1 And I am on the "Test assignment name" "assign activity" page logged in as student1
Then I should see "50.00" Then I should see "50.00"
@ -62,7 +62,7 @@ Feature: Teacher can unhide grades on the edit page allowing students to view th
Given I click on grade item menu "Test assignment name" of type "gradeitem" on "setup" page 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 choose "Edit grade item" in the open action menu
And I set the field "Hidden" to "1" And I set the field "Hidden" to "1"
And I press "Save changes" And I click on "Save" "button" in the "Edit grade item" "dialogue"
And I log out And I log out
And I am on the "Test assignment name" "assign activity" page logged in as student1 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 "50.00"

View file

@ -33,23 +33,23 @@ Feature: Grade item validation
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | MI 1 | | Item name | MI 1 |
And I press "Save changes" 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 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 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 choose "Edit grade item" in the open action menu
When I should not see "Some grades have already been awarded, so the grade type" When I should not see "Some grades have already been awarded, so the grade type"
Then I set the field "Grade type" to "Scale" Then I set the field "Grade type" to "Scale"
And I press "Save changes" And I click on "Save" "button" in the "Edit grade item" "dialogue"
And I should see "Scale must be selected" And I should see "Scale must be selected"
And I set the field "Scale" to "ABCDEF" And I set the field "Scale" to "ABCDEF"
And I press "Save changes" 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 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 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 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 should not see "Some grades have already been awarded, so the grade type"
And I set the field "Scale" to "Letter scale" And I set the field "Scale" to "Letter scale"
And I press "Save changes" 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" 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 Scenario: Attempting to change a manual item's grade type when grades already exist
@ -68,7 +68,7 @@ Feature: Grade item validation
And I choose "Edit grade item" in the open action menu 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 "Grade type" to "Scale"
And I set the field "Scale" to "ABCDEF" And I set the field "Scale" to "ABCDEF"
And I press "Save changes" 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 navigate to "View > Grader report" in the course gradebook
And I turn editing mode on 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 give the grade "C" to the user "Student 1" for the grade item "MI 1"

View file

@ -32,38 +32,38 @@ Feature: We can use a minimum grade different than zero
| Item name | Manual item 1 | | Item name | Manual item 1 |
| Minimum grade | -100 | | Minimum grade | -100 |
| Grade category | Course 1 | | Grade category | Course 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 2 | | Item name | Manual item 2 |
| Minimum grade | 50 | | Minimum grade | 50 |
| Grade category | Course 1 | | Grade category | Course 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 3 | | Item name | Manual item 3 |
| Maximum grade | 50 | | Maximum grade | 50 |
| Minimum grade | -100 | | Minimum grade | -100 |
| Grade category | Sub category 1 | | Grade category | Sub category 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 4 | | Item name | Manual item 4 |
| Minimum grade | -100 | | Minimum grade | -100 |
| Grade category | Sub category 1 | | Grade category | Sub category 1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 5 | | Item name | Manual item 5 |
| Minimum grade | 50 | | Minimum grade | 50 |
| Grade category | Sub category 2 | | Grade category | Sub category 2 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | Manual item 6 | | Item name | Manual item 6 |
| Minimum grade | 50 | | Minimum grade | 50 |
| Grade category | Sub category 2 | | Grade category | Sub category 2 |
And I press "Save changes" 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 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 weightings" to "Show"
And I set the field "Show contribution to course total" to "Show" And I set the field "Show contribution to course total" to "Show"

View file

@ -30,27 +30,27 @@ Feature: We can choose what min or max grade to use when aggregating grades.
And I set the following fields to these values: And I set the following fields to these values:
| Item name | MI 1 | | Item name | MI 1 |
| Grade category | C1 | | Grade category | C1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | MI 2 | | Item name | MI 2 |
| Grade category | C1 | | Grade category | C1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | MI 3 | | Item name | MI 3 |
| Grade category | CAT1 | | Grade category | CAT1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | MI 4 | | Item name | MI 4 |
| Grade category | CAT1 | | Grade category | CAT1 |
And I press "Save changes" And I click on "Save" "button" in the "New grade item" "dialogue"
And I press "Add grade item" And I press "Add grade item"
And I set the following fields to these values: And I set the following fields to these values:
| Item name | MI 5 | | Item name | MI 5 |
| Grade category | C1 | | Grade category | C1 |
And I press "Save changes" 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: And I set "=[[mi1]]+[[mi2]]+[[mi3]]" calculation for grade item "MI 5" with idnumbers:
| MI 1 | mi1 | | MI 1 | mi1 |
| MI 2 | mi2 | | MI 2 | mi2 |

View file

@ -93,7 +93,7 @@ Feature: Control the aggregation of the scales
Then the field "Override weight of Grade me" matches value "100.00" 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 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 choose "Edit grade item" in the open action menu
And I follow "Show more..." 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 adjusted"
And I should not see "Weight" And I should not see "Weight"
And the following config values are set as admin: And the following config values are set as admin:
@ -106,6 +106,6 @@ Feature: Control the aggregation of the scales
And the field "Override weight of Scale me" matches value "4.8" 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 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 choose "Edit grade item" in the open action menu
And I follow "Show more..." And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And I should see "Weight adjusted" And I should see "Weight adjusted"
And I should see "Weight" And I should see "Weight"

View file

@ -64,6 +64,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 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" Then the field "Grade to pass" matches value "25"
And I am on "Course 1" course homepage And I am on "Course 1" course homepage
And I am on the "Test Assignment 1" "assign activity" page And I am on the "Test Assignment 1" "assign activity" page
@ -74,6 +75,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 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" And the field "Grade to pass" matches value "30"
Scenario: Set a valid grade to pass for an assignment activity using scales Scenario: Set a valid grade to pass for an assignment activity using scales
@ -88,7 +90,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "3" Then the field "Grade to pass" matches value "3"
And I set the field "Grade to pass" to "4" And I set the field "Grade to pass" to "4"
And I press "Save changes" And I press "Save changes"
@ -123,13 +125,13 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "40" Then the field "Grade to pass" matches value "40"
And I set the field "Grade to pass" to "45" And I set the field "Grade to pass" to "45"
And I press "Save changes" And I press "Save changes"
And I click on grade item menu "Test Workshop 1 (assessment)" of type "gradeitem" on "grader" page 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
And the field "Grade to pass" matches value "10" And the field "Grade to pass" matches value "10"
And I set the field "Grade to pass" to "15" And I set the field "Grade to pass" to "15"
And I press "Save changes" And I press "Save changes"
@ -165,7 +167,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "9.5" Then the field "Grade to pass" matches value "9.5"
And I set the field "Grade to pass" to "8" And I set the field "Grade to pass" to "8"
And I press "Save changes" And I press "Save changes"
@ -186,7 +188,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90" Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80" And I set the field "Grade to pass" to "80"
And I press "Save changes" And I press "Save changes"
@ -208,7 +210,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90#50" Then the field "Grade to pass" matches value "90#50"
And I set the field "Grade to pass" to "80" And I set the field "Grade to pass" to "80"
And I press "Save changes" And I press "Save changes"
@ -231,7 +233,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90" Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80" And I set the field "Grade to pass" to "80"
And I press "Save changes" And I press "Save changes"
@ -269,7 +271,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90" Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80" And I set the field "Grade to pass" to "80"
And I press "Save changes" And I press "Save changes"
@ -291,7 +293,7 @@ Feature: We can set the grade to pass value
And I navigate to "View > Grader report" in the course gradebook 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 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 choose "Edit grade item" in the open action menu
And I expand all fieldsets And I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Grade to pass" matches value "90" Then the field "Grade to pass" matches value "90"
And I set the field "Grade to pass" to "80" And I set the field "Grade to pass" to "80"
And I press "Save changes" And I press "Save changes"

View file

@ -68,7 +68,7 @@ Feature: I can grade a students interaction across a forum
# The values saved should be reflected here. # The values saved should be reflected here.
And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
When I expand all fieldsets When I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Maximum grade" matches value "10" Then the field "Maximum grade" matches value "10"
Then the field "Grade to pass" matches value "4" Then the field "Grade to pass" matches value "4"
And I should see "Tutor" in the "Parent category" "fieldset" And I should see "Tutor" in the "Parent category" "fieldset"
@ -121,7 +121,7 @@ Feature: I can grade a students interaction across a forum
# The values saved should be reflected here. # The values saved should be reflected here.
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page 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 choose "Edit grade item" in the open action menu
When I expand all fieldsets When I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Maximum grade" matches value "10" Then the field "Maximum grade" matches value "10"
Then the field "Grade to pass" matches value "4" Then the field "Grade to pass" matches value "4"
And I should see "Tutor" in the "Parent category" "fieldset" And I should see "Tutor" in the "Parent category" "fieldset"
@ -149,15 +149,15 @@ Feature: I can grade a students interaction across a forum
# The values saved should be reflected here. # The values saved should be reflected here.
And I click on grade item menu "Test Forum 1 rating" of type "gradeitem" on "grader" page 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 choose "Edit grade item" in the open action menu
When I expand all fieldsets When I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Maximum grade" matches value "100" Then the field "Maximum grade" matches value "100"
Then the field "Grade to pass" matches value "40" Then the field "Grade to pass" matches value "40"
And I should see "Peers" in the "Parent category" "fieldset" And I should see "Peers" in the "Parent category" "fieldset"
And I press "cancel" And I press "Cancel"
And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page And I click on grade item menu "Test Forum 1 whole forum" of type "gradeitem" on "grader" page
And I choose "Edit grade item" in the open action menu And I choose "Edit grade item" in the open action menu
When I expand all fieldsets When I click on "Show more..." "link" in the ".modal-dialog" "css_element"
Then the field "Maximum grade" matches value "10" Then the field "Maximum grade" matches value "10"
Then the field "Grade to pass" matches value "4" Then the field "Grade to pass" matches value "4"
And I should see "Tutor" in the "Parent category" "fieldset" And I should see "Tutor" in the "Parent category" "fieldset"

View file

@ -29,7 +29,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$version = 2023061600.00; // YYYYMMDD = weekly release date of this DEV branch. $version = 2023061600.01; // YYYYMMDD = weekly release date of this DEV branch.
// RR = release increments - 00 in DEV branches. // RR = release increments - 00 in DEV branches.
// .XX = incremental changes. // .XX = incremental changes.
$release = '4.3dev (Build: 20230616)'; // Human-friendly version name $release = '4.3dev (Build: 20230616)'; // Human-friendly version name