Merge branch 'MDL-64862-master-workshopgradepass' of git://github.com/mudrd8mz/moodle

This commit is contained in:
Sara Arjona 2019-02-25 18:31:10 +01:00
commit 4b227ead88
2 changed files with 18 additions and 4 deletions

View File

@ -370,8 +370,7 @@ class mod_workshop_mod_form extends moodleform_mod {
// gradecategory and gradinggradecategory - grrr QuickForms
$decimalpoints = $gradeitem->get_decimals();
if ($gradeitem->itemnumber == 0) {
$submissiongradepass = $mform->getElement('submissiongradepass');
$submissiongradepass->setValue(format_float($gradeitem->gradepass, $decimalpoints));
$mform->setDefault('submissiongradepass', format_float($gradeitem->gradepass, $decimalpoints));
$group = $mform->getElement('submissiongradegroup');
$elements = $group->getElements();
foreach ($elements as $element) {
@ -380,8 +379,7 @@ class mod_workshop_mod_form extends moodleform_mod {
}
}
} else if ($gradeitem->itemnumber == 1) {
$gradinggradepass = $mform->getElement('gradinggradepass');
$gradinggradepass->setValue(format_float($gradeitem->gradepass, $decimalpoints));
$mform->setDefault('gradinggradepass', format_float($gradeitem->gradepass, $decimalpoints));
$group = $mform->getElement('gradinggradegroup');
$elements = $group->getElements();
foreach ($elements as $element) {

View File

@ -29,6 +29,22 @@ Feature: Setting grades to pass via workshop editing form
And the field "Submission grade to pass" matches value "45.00"
And the field "Assessment grade to pass" matches value "10.50"
@javascript
Scenario: Grade to pass kept even with submission types without online text (MDL-64862)
Given I log in as "teacher1"
And I am on "Course1" course homepage with editing mode on
When I add a "Workshop" to section "1" and I fill the form with:
| Workshop name | Another workshop |
| Description | Grades to pass are set here |
| Submission grade to pass | 42 |
| Assessment grade to pass | 10.1 |
| submissiontypetextavailable | 0 |
Then I should not see "Adding a new Workshop"
And I follow "Another workshop"
And I navigate to "Edit settings" in current page administration
And the field "Submission grade to pass" matches value "42.00"
And the field "Assessment grade to pass" matches value "10.10"
Scenario: Adding a new workshop with grade to pass fields left empty
Given I log in as "teacher1"
And I am on "Course1" course homepage with editing mode on