MDL-68915 lesson: Do not allow maxgrade change
Do not allow maxgrade change when some of the users are already graded. As of now this is applicable to the following activities: 1. Forum 2. Database 3. Lesson 4. Glossary Signed-off-by: Sujith Haridasan <[email protected]>
This commit is contained in:
@@ -240,6 +240,13 @@ class MoodleQuickForm_modgrade extends MoodleQuickForm_group {
|
||||
$label = html_writer::tag('label', $this->maxgradeformelement->getLabel(),
|
||||
array('for' => $this->maxgradeformelement->getAttribute('id')));
|
||||
$this->_elements[] = $this->createFormElement('static', 'pointlabel', '', $label);
|
||||
|
||||
// Check if there are grades and if so then disable maxgradeformelement.
|
||||
if ($this->hasgrades) {
|
||||
// If it has grades then disable it.
|
||||
$this->maxgradeformelement->updateAttributes(['disabled' => 'disabled']);
|
||||
}
|
||||
|
||||
$this->_elements[] = $this->maxgradeformelement;
|
||||
$this->_elements[] = $this->createFormElement('static', 'pointspacer', '', '<br />');
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
@mod @mod_data @core_grades @core_form
|
||||
Feature: Using the database activities which support point scale
|
||||
validate if we can change the maximum grade when users are graded
|
||||
As a teacher
|
||||
I need to know whether I can not edit value of Maximum grade input field
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| data | Test database name | n | C1 | data1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Database rescale grade should not be possible when users are graded
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "Text input" field to "Test database name" database and I fill the form with:
|
||||
| Field name | Test field name |
|
||||
| Field description | Test field description |
|
||||
And I follow "Templates"
|
||||
And I wait until the page is ready
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test database name"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Ratings > Aggregate type" to "Count of ratings"
|
||||
And I set the field "Ratings > Type" to "Point"
|
||||
And I press "Save and return to course"
|
||||
And I log out
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add an entry to "Test database name" database with:
|
||||
| Test field name | Student original entry |
|
||||
| Test field name | Student original entry 2 |
|
||||
And I press "Save and view"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test database name"
|
||||
And I follow "View single"
|
||||
And I set the field "rating" to "51"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test database name"
|
||||
When I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
Then the "Maximum grade" "field" should be disabled
|
||||
@@ -0,0 +1,49 @@
|
||||
@mod @mod_forum @core_grades @core_form
|
||||
Feature: Using the forum activities which support point scale
|
||||
validate if we can change the maximum grade when users are graded
|
||||
As a teacher
|
||||
I need to know whether I can not edit value of Maximum grade input field
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| course | C1 |
|
||||
| activity | forum |
|
||||
| name | Test forum name |
|
||||
| description | Test forum description |
|
||||
| idnumber | forum1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Forum rescale grade should not be possible when users are graded
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a new discussion to "Test forum name" forum with:
|
||||
| Subject | Discussion subject |
|
||||
| Message | Test post in forum 1 |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test forum name"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Ratings > Aggregate type" to "Count of ratings"
|
||||
And I set the field "Ratings > Type" to "Point"
|
||||
And I press "Save and return to course"
|
||||
And I follow "Test forum name"
|
||||
And I follow "Discussion subject"
|
||||
And I set the field "rating" to "30"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test forum name"
|
||||
When I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
Then the "Maximum grade" "field" should be disabled
|
||||
@@ -0,0 +1,51 @@
|
||||
@mod @mod_glossary @core_grades @core_form
|
||||
Feature: Using the glossary activities which support point scale
|
||||
validate if we can change the maximum grade when users are graded
|
||||
As a teacher
|
||||
I need to know whether I can not edit value of Maximum grade input field
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| course | C1 |
|
||||
| activity | glossary |
|
||||
| name | Test glossary name |
|
||||
| description | Test glossary description |
|
||||
| idnumber | glossary1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Glossary rescale grade should not be possible when users are graded
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test glossary name"
|
||||
And I press "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Concept | Testing score |
|
||||
| Definition | Scoring high on tests |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test glossary name"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Ratings > Aggregate type" to "Count of ratings"
|
||||
And I set the field "Ratings > Type" to "Point"
|
||||
And I press "Save and return to course"
|
||||
And I follow "Test glossary name"
|
||||
And I set the field "rating" to "50"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test glossary name"
|
||||
When I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
Then the "Maximum grade" "field" should be disabled
|
||||
@@ -0,0 +1,54 @@
|
||||
@mod @mod_lesson @core_grades @core_form
|
||||
Feature: Using the lesson activities which support point scale
|
||||
validate if we can change the maximum grade when users are graded
|
||||
As a teacher
|
||||
I need to know whether I can not edit value of Maximum grade input field
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| course | C1 |
|
||||
| activity | lesson |
|
||||
| name | Test lesson name |
|
||||
| intro | Test forum description |
|
||||
| idnumber | lesson1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Lesson rescale grade should not be possible when users are graded
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test lesson name"
|
||||
And I follow "Add a question page"
|
||||
And I set the field "Select a question type" to "Numerical"
|
||||
And I press "Add a question page"
|
||||
And I set the following fields to these values:
|
||||
| Page title | Numerical question |
|
||||
| Page contents | What is 1 + 2? |
|
||||
| id_answer_editor_0 | 3 |
|
||||
| id_jumpto_0 | End of lesson |
|
||||
| id_enableotheranswers | 1 |
|
||||
| id_jumpto_6 | Next page |
|
||||
And I press "Save page"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test lesson name"
|
||||
And I set the field "Your answer" to "5"
|
||||
And I press "Submit"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test lesson name"
|
||||
When I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
Then the "Maximum grade" "field" should be disabled
|
||||
Reference in New Issue
Block a user