mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
MDL-81411 mod_assign: Use choicelist for Additional attempts.
This commit is contained in:
parent
d32844ce29
commit
45227cb644
@ -95,7 +95,9 @@ $string['attemptreopenmethod_help'] = 'This setting controls how students are gr
|
||||
* Manually - After each attempt, you can grant the next one through the Submissions page or the Grader page.
|
||||
* Automatically until pass - After each attempt, the next will be granted automatically, until the student achieves the passing grade.';
|
||||
$string['attemptreopenmethod_manual'] = 'Manually';
|
||||
$string['attemptreopenmethod_manual_help'] = 'After each attempt, you can grant the next one through the Submissions page or the Grader page.';
|
||||
$string['attemptreopenmethod_untilpass'] = 'Automatically until pass';
|
||||
$string['attemptreopenmethod_untilpass_help'] = 'After each attempt, the next will be granted automatically, until the student achieves the passing grade.';
|
||||
$string['availability'] = 'Availability';
|
||||
$string['back'] = 'Back';
|
||||
$string['backtoassignment'] = 'Back to assignment';
|
||||
|
@ -42,7 +42,7 @@ class mod_assign_mod_form extends moodleform_mod {
|
||||
* @return void
|
||||
*/
|
||||
public function definition() {
|
||||
global $CFG, $COURSE, $DB, $PAGE;
|
||||
global $CFG, $COURSE, $DB;
|
||||
$mform = $this->_form;
|
||||
|
||||
$mform->addElement('header', 'general', get_string('general', 'form'));
|
||||
@ -143,12 +143,20 @@ class mod_assign_mod_form extends moodleform_mod {
|
||||
$mform->addElement('select', 'maxattempts', get_string('maxattempts', 'mod_assign'), $options);
|
||||
$mform->addHelpButton('maxattempts', 'maxattempts', 'assign');
|
||||
|
||||
$options = [
|
||||
ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL => get_string('attemptreopenmethod_manual', 'mod_assign'),
|
||||
ASSIGN_ATTEMPT_REOPEN_METHOD_UNTILPASS => get_string('attemptreopenmethod_untilpass', 'mod_assign')
|
||||
];
|
||||
$mform->addElement('select', 'attemptreopenmethod', get_string('attemptreopenmethod', 'mod_assign'), $options);
|
||||
$mform->addHelpButton('attemptreopenmethod', 'attemptreopenmethod', 'mod_assign');
|
||||
$choice = new core\output\choicelist();
|
||||
|
||||
$choice->add_option(
|
||||
value: ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL,
|
||||
name: get_string('attemptreopenmethod_manual', 'mod_assign'),
|
||||
definition: ['description' => get_string('attemptreopenmethod_manual_help', 'mod_assign')]
|
||||
);
|
||||
$choice->add_option(
|
||||
value: ASSIGN_ATTEMPT_REOPEN_METHOD_UNTILPASS,
|
||||
name: get_string('attemptreopenmethod_untilpass', 'mod_assign'),
|
||||
definition: ['description' => get_string('attemptreopenmethod_untilpass_help', 'mod_assign')]
|
||||
);
|
||||
|
||||
$mform->addElement('choicedropdown', 'attemptreopenmethod', get_string('attemptreopenmethod', 'mod_assign'), $choice);
|
||||
$mform->hideIf('attemptreopenmethod', 'maxattempts', 'eq', 1);
|
||||
|
||||
$mform->addElement('header', 'groupsubmissionsettings', get_string('groupsubmissionsettings', 'assign'));
|
||||
|
126
mod/assign/tests/behat/assign_settings.feature
Normal file
126
mod/assign/tests/behat/assign_settings.feature
Normal file
@ -0,0 +1,126 @@
|
||||
@mod @mod_assign
|
||||
Feature: Assignments settings can be changed
|
||||
In order to allow managing assignments
|
||||
As a teacher
|
||||
I need to be able to change various assignment settings.
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category | enablecompletion |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "activity" exists:
|
||||
| activity | assign |
|
||||
| course | C1 |
|
||||
| name | Test assignment name |
|
||||
| intro | Submit your online text |
|
||||
| assignsubmission_onlinetext_enabled | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
| maxattempts | -1 |
|
||||
| attemptreopenmethod | manual |
|
||||
| hidegrader | 1 |
|
||||
| submissiondrafts | 0 |
|
||||
| completion | 2 |
|
||||
| completionview | 1 |
|
||||
| completionusegrade | 1 |
|
||||
| gradepass | 50 |
|
||||
| completionpassgrade | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
| student3 | Student | 3 | student2@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
| student3 | C1 | student |
|
||||
|
||||
@javascript
|
||||
Scenario: Changing Grant Attempts settings on activity page
|
||||
# Initially Grant Attempts is set to Manually.
|
||||
Given I am on the "Test assignment name" Activity page logged in as student1
|
||||
And I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | I'm the student attempt |
|
||||
And I press "Save changes"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as teacher1
|
||||
And I follow "View all submissions"
|
||||
And I click on "Grade" "link" in the "Student 1" "table_row"
|
||||
And I set the field "Grade out of 100" to "40"
|
||||
And I set the field "Notify student" to "0"
|
||||
And I press "Save changes"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as student1
|
||||
And "Add a new attempt" "button" should not exist
|
||||
And "Add a new attempt based on previous submission" "button" should not exist
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as teacher1
|
||||
And I follow "View all submissions"
|
||||
And I open the action menu in "Student 1" "table_row"
|
||||
And I follow "Allow another attempt"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as student1
|
||||
And "Add a new attempt" "button" should exist
|
||||
And "Add a new attempt based on previous submission" "button" should exist
|
||||
|
||||
# Set Grant Attempts to Automatically Until Pass.
|
||||
And I am on the "Test assignment name" Activity page logged in as teacher1
|
||||
And I navigate to "Settings" in current page administration
|
||||
And the field "attemptreopenmethod" matches value "manual"
|
||||
And I set the following fields to these values:
|
||||
| attemptreopenmethod | untilpass |
|
||||
And I press "Save and display"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as student2
|
||||
And I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | I'm the student attempt |
|
||||
And I press "Save changes"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as teacher1
|
||||
And I follow "View all submissions"
|
||||
And I click on "Grade" "link" in the "Student 2" "table_row"
|
||||
And I set the field "Grade out of 100" to "40"
|
||||
And I set the field "Notify student" to "0"
|
||||
And I press "Save changes"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as student2
|
||||
And "Add a new attempt" "button" should exist
|
||||
And "Add a new attempt based on previous submission" "button" should exist
|
||||
|
||||
# Set Grant Attempts back to Manually.
|
||||
And I am on the "Test assignment name" Activity page logged in as teacher1
|
||||
And I navigate to "Settings" in current page administration
|
||||
And the field "attemptreopenmethod" matches value "untilpass"
|
||||
And I set the following fields to these values:
|
||||
| attemptreopenmethod | manual |
|
||||
And I press "Save and display"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as student3
|
||||
And I press "Add submission"
|
||||
And I set the following fields to these values:
|
||||
| Online text | I'm the student attempt |
|
||||
And I press "Save changes"
|
||||
|
||||
When I am on the "Test assignment name" Activity page logged in as teacher1
|
||||
And I follow "View all submissions"
|
||||
And I click on "Grade" "link" in the "Student 3" "table_row"
|
||||
And I set the field "Grade out of 100" to "40"
|
||||
And I set the field "Notify student" to "0"
|
||||
And I press "Save changes"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as student3
|
||||
And "Add a new attempt" "button" should not exist
|
||||
And "Add a new attempt based on previous submission" "button" should not exist
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as teacher1
|
||||
And I follow "View all submissions"
|
||||
And I open the action menu in "Student 3" "table_row"
|
||||
And I follow "Allow another attempt"
|
||||
|
||||
And I am on the "Test assignment name" Activity page logged in as student3
|
||||
Then "Add a new attempt" "button" should exist
|
||||
And "Add a new attempt based on previous submission" "button" should exist
|
Loading…
x
Reference in New Issue
Block a user