diff --git a/badges/tests/behat/criteria_activity.feature b/badges/tests/behat/criteria_activity.feature index 128e9325b6a..98cae5e8fb7 100644 --- a/badges/tests/behat/criteria_activity.feature +++ b/badges/tests/behat/criteria_activity.feature @@ -25,8 +25,8 @@ Feature: Award badges based on activity completion | questioncategory | qtype | name | questiontext | | Test questions | truefalse | First question | Answer the first question | And the following "activities" exist: - | activity | name | course | idnumber | attempts | gradepass | completion | completionattemptsexhausted | completionpass | completionusegrade | - | quiz | Test quiz name | C1 | quiz1 | 2 | 5.00 | 2 | 1 | 1 | 1 | + | activity | name | course | idnumber | attempts | gradepass | completion | completionattemptsexhausted | completionpassgrade | completionusegrade | + | quiz | Test quiz name | C1 | quiz1 | 2 | 5.00 | 2 | 1 | 1 | 1 | And quiz "Test quiz name" contains the following questions: | question | page | | First question | 1 | @@ -53,7 +53,8 @@ Feature: Award badges based on activity completion Scenario: Student earns a badge using activity completion, but does not get passing grade Given I log in as "student1" And I am on "Course 1" course homepage - And the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed" + And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo" When I am on the "Test quiz name" "quiz activity" page And I press "Re-attempt quiz" diff --git a/completion/tests/bulk_update_test.php b/completion/tests/bulk_update_test.php index 69dcd09129d..834ba7fd5ee 100644 --- a/completion/tests/bulk_update_test.php +++ b/completion/tests/bulk_update_test.php @@ -80,7 +80,7 @@ class core_completion_bulk_update_testcase extends advanced_testcase { 'lti-2' => ['lti', ['completion' => COMPLETION_TRACKING_MANUAL]], 'page-1' => ['page', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]], 'page-2' => ['page', ['completion' => COMPLETION_TRACKING_MANUAL]], - 'quiz-1' => ['quiz', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionpass' => 1]], + 'quiz-1' => ['quiz', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionpassgrade' => 1]], 'quiz-2' => ['quiz', ['completion' => COMPLETION_TRACKING_MANUAL]], 'resource-1' => ['resource', ['completion' => COMPLETION_TRACKING_AUTOMATIC, 'completionview' => 1]], 'resource-2' => ['resource', ['completion' => COMPLETION_TRACKING_MANUAL]], diff --git a/mod/quiz/backup/moodle2/backup_quiz_stepslib.php b/mod/quiz/backup/moodle2/backup_quiz_stepslib.php index 0e5e071e19b..db54617df2c 100644 --- a/mod/quiz/backup/moodle2/backup_quiz_stepslib.php +++ b/mod/quiz/backup/moodle2/backup_quiz_stepslib.php @@ -49,7 +49,7 @@ class backup_quiz_activity_structure_step extends backup_questions_activity_stru 'questionsperpage', 'navmethod', 'shuffleanswers', 'sumgrades', 'grade', 'timecreated', 'timemodified', 'password', 'subnet', 'browsersecurity', - 'delay1', 'delay2', 'showuserpicture', 'showblocks', 'completionattemptsexhausted', 'completionpass', + 'delay1', 'delay2', 'showuserpicture', 'showblocks', 'completionattemptsexhausted', 'completionminattempts', 'allowofflineattempts')); // Define elements for access rule subplugin settings. diff --git a/mod/quiz/backup/moodle2/restore_quiz_stepslib.php b/mod/quiz/backup/moodle2/restore_quiz_stepslib.php index 6bdb81376ff..31b0fdffb3a 100644 --- a/mod/quiz/backup/moodle2/restore_quiz_stepslib.php +++ b/mod/quiz/backup/moodle2/restore_quiz_stepslib.php @@ -292,6 +292,12 @@ class restore_quiz_activity_structure_step extends restore_questions_activity_st $DB->insert_record('quizaccess_seb_quizsettings', $sebsettings); } + + // If we are dealing with a backup from < 4.0 then we need to move completionpass to core. + if (!empty($data->completionpass)) { + $params = ['id' => $this->task->get_moduleid()]; + $DB->set_field('course_modules', 'completionpassgrade', $data->completionpass, $params); + } } protected function process_quiz_question_instance($data) { diff --git a/mod/quiz/classes/external.php b/mod/quiz/classes/external.php index afd8194475b..eec1ab81afb 100644 --- a/mod/quiz/classes/external.php +++ b/mod/quiz/classes/external.php @@ -131,9 +131,12 @@ class mod_quiz_external extends external_api { 'reviewspecificfeedback', 'reviewgeneralfeedback', 'reviewrightanswer', 'reviewoverallfeedback', 'questionsperpage', 'navmethod', 'browsersecurity', 'delay1', 'delay2', 'showuserpicture', 'showblocks', - 'completionattemptsexhausted', 'completionpass', 'overduehandling', + 'completionattemptsexhausted', 'overduehandling', 'graceperiod', 'canredoquestions', 'allowofflineattempts'); $viewablefields = array_merge($viewablefields, $additionalfields); + + // Any course module fields that previously existed in quiz. + $quizdetails['completionpass'] = $quizobj->get_cm()->completionpassgrade; } // Fields only for managers. diff --git a/mod/quiz/db/install.xml b/mod/quiz/db/install.xml index 8d7524e2322..127daed08eb 100644 --- a/mod/quiz/db/install.xml +++ b/mod/quiz/db/install.xml @@ -1,5 +1,5 @@ - @@ -45,7 +45,6 @@ - diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index a18665aad21..8ae2d577b51 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -60,5 +60,45 @@ function xmldb_quiz_upgrade($oldversion) { upgrade_mod_savepoint(true, 2020061501, 'quiz'); } + if ($oldversion < 2021052503) { + $table = new xmldb_table('quiz'); + $field = new xmldb_field('completionpass'); + + if ($dbman->field_exists($table, $field)) { + $sql = "SELECT q.id " . + "FROM {quiz} q " . + "INNER JOIN {course_modules} cm ON cm.instance = q.id " . + "INNER JOIN {modules} m ON m.id = cm.module " . + "WHERE m.name = :name AND q.completionpass = :completionpass"; + + /** @var moodle_recordset $records */ + $records = $DB->get_recordset_sql($sql, ['name' => 'quiz', 'completionpass' => 1], 0, 1000); + while ($records->valid()) { + foreach ($records as $record) { + $ids[] = $record->id; + } + + if ($ids) { + list($insql, $params) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED); + $DB->set_field_select('course_modules', 'completionpassgrade', 1, "instance $insql", $params); + + // Reset the value so it doesn't get picked on the next run. The field will be dropped later. + $DB->set_field_select('quiz', 'completionpass', 0, "id $insql", $params); + + // Get the next batch of records. + $records = $DB->get_recordset_sql($sql, ['name' => 'quiz', 'completionpass' => 1], 0, 1000); + } + } + $records->close(); + + // We have completed our checks. Drop the field. + if ($dbman->field_exists($table, $field)) { + $dbman->drop_field($table, $field); + } + } + + upgrade_mod_savepoint(true, 2021052503, 'quiz'); + } + return true; } diff --git a/mod/quiz/deprecatedlib.php b/mod/quiz/deprecatedlib.php index e0afb2e6715..07c39ea8cfc 100644 --- a/mod/quiz/deprecatedlib.php +++ b/mod/quiz/deprecatedlib.php @@ -40,7 +40,7 @@ function quiz_completion_check_passing_grade_or_all_attempts($course, $cm, $user debugging('quiz_completion_check_passing_grade_or_all_attempts has been deprecated.', DEBUG_DEVELOPER); - if (!$quiz->completionpass) { + if (!$cm->completionpassgrade) { return true; } @@ -118,7 +118,7 @@ function quiz_get_completion_state($course, $cm, $userid, $type) { // No need to call debugging here. Deprecation debugging notice already being called in \completion_info::internal_get_state(). $quiz = $DB->get_record('quiz', array('id' => $cm->instance), '*', MUST_EXIST); - if (!$quiz->completionattemptsexhausted && !$quiz->completionpass && !$quiz->completionminattempts) { + if (!$quiz->completionattemptsexhausted && !$cm->completionpassgrade && !$quiz->completionminattempts) { return $type; } diff --git a/mod/quiz/lang/en/deprecated.txt b/mod/quiz/lang/en/deprecated.txt index ecadc8221b1..bc4aac1394c 100644 --- a/mod/quiz/lang/en/deprecated.txt +++ b/mod/quiz/lang/en/deprecated.txt @@ -2,3 +2,8 @@ numattemptsmade,mod_quiz reviewofattempt,mod_quiz reviewofpreview,mod_quiz settingsoverrides,mod_quiz +completionpass,mod_quiz +completionpassdesc,mod_quiz +completionpass_help,mod_quiz +completiondetail:passgrade,mod_quiz +gradetopassnotset,mod_quiz diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index e25765faa18..67ed5bdd377 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -181,15 +181,11 @@ $string['commentorgrade'] = 'Make comment or override grade'; $string['comments'] = 'Comments'; $string['completedon'] = 'Completed on'; $string['completiondetail:minattempts'] = 'Make attempts: {$a}'; -$string['completiondetail:passgrade'] = 'Receive a pass grade'; $string['completiondetail:passorexhaust'] = 'Receive a pass grade or complete all available attempts'; $string['completionminattempts'] = 'Minimum number of attempts:'; $string['completionminattemptsdesc'] = 'Minimum number of attempts required: {$a}'; $string['completionminattemptsgroup'] = 'Require attempts'; $string['completionminattemptserror'] = 'Minimum number of attempts must be lower or equal to attempts allowed.'; -$string['completionpass'] = 'Require passing grade'; -$string['completionpassdesc'] = 'Student must achieve a passing grade to complete this activity'; -$string['completionpass_help'] = 'If enabled, this activity is considered complete when the student receives a pass grade (as specified in the Grade section of the quiz settings) or higher.'; $string['completionpassorattemptsexhausteddesc'] = 'Student must achieve a passing grade, or exhaust all available attempts to complete this activity'; $string['completionattemptsexhausted'] = 'Or all available attempts completed'; $string['completionattemptsexhausted_help'] = 'Mark quiz complete when the student has exhausted the maximum number of attempts.'; @@ -421,7 +417,6 @@ $string['grademethod_help'] = 'When multiple attempts are allowed, the following * Last attempt (all other attempts are ignored)'; $string['gradesdeleted'] = 'Quiz grades deleted'; $string['gradesofar'] = '{$a->method}: {$a->mygrade} / {$a->quizgrade}.'; -$string['gradetopassnotset'] = 'This quiz does not yet have a grade to pass set. It may be set in the Grade section of the quiz settings.'; $string['gradetopassmustbeset'] = 'Grade to pass cannot be zero as this quiz has its completion method set to require passing grade. Please set a non-zero value.'; $string['gradetopassoutof'] = 'Grade to pass: {$a->grade} out of {$a->maxgrade}'; $string['gradingdetails'] = 'Marks for this submission: {$a->raw}/{$a->max}.'; @@ -1037,3 +1032,10 @@ $string['settingsoverrides'] = 'Settings overrides'; // Deprecated since Moodle 3.11. $string['completionattemptsexhausteddesc'] = 'Complete if all available attempts are exhausted'; + +// Deprecated since Moodle 4.0. +$string['completionpass'] = 'Require passing grade'; +$string['completionpassdesc'] = 'Student must achieve a passing grade to complete this activity'; +$string['completionpass_help'] = 'If enabled, this activity is considered complete when the student receives a pass grade (as specified in the Grade section of the quiz settings) or higher.'; +$string['completiondetail:passgrade'] = 'Receive a pass grade'; +$string['gradetopassnotset'] = 'This quiz does not yet have a grade to pass set. It may be set in the Grade section of the quiz settings.'; diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index c0209589272..db73cd4daf8 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -1129,9 +1129,9 @@ function quiz_process_options($quiz) { // Ensure that disabled checkboxes in completion settings are set to 0. if (empty($quiz->completionusegrade)) { - $quiz->completionpass = 0; + $quiz->completionpassgrade = 0; } - if (empty($quiz->completionpass)) { + if (empty($quiz->completionpassgrade)) { $quiz->completionattemptsexhausted = 0; } if (empty($quiz->completionminattemptsenabled)) { @@ -2092,7 +2092,7 @@ function quiz_get_coursemodule_info($coursemodule) { global $DB; $dbparams = ['id' => $coursemodule->instance]; - $fields = 'id, name, intro, introformat, completionattemptsexhausted, completionpass, completionminattempts, + $fields = 'id, name, intro, introformat, completionattemptsexhausted, completionminattempts, timeopen, timeclose'; if (!$quiz = $DB->get_record('quiz', $dbparams, $fields)) { return false; @@ -2108,9 +2108,9 @@ function quiz_get_coursemodule_info($coursemodule) { // Populate the custom completion rules as key => value pairs, but only if the completion mode is 'automatic'. if ($coursemodule->completion == COMPLETION_TRACKING_AUTOMATIC) { - if ($quiz->completionpass || $quiz->completionattemptsexhausted) { + if ($quiz->completionattemptsexhausted) { $result->customdata['customcompletionrules']['completionpassorattemptsexhausted'] = [ - 'completionpass' => $quiz->completionpass, + 'completionpassgrade' => $coursemodule->completionpassgrade, 'completionattemptsexhausted' => $quiz->completionattemptsexhausted, ]; } else { @@ -2206,16 +2206,11 @@ function mod_quiz_get_completion_active_rule_descriptions($cm) { if (!empty($rules['completionpassorattemptsexhausted'])) { if (!empty($rules['completionpassorattemptsexhausted']['completionattemptsexhausted'])) { $descriptions[] = get_string('completionpassorattemptsexhausteddesc', 'quiz'); - } else if (!empty($rules['completionpassorattemptsexhausted']['completionpass'])) { - $descriptions[] = get_string('completionpassdesc', 'quiz', - format_time($rules['completionpassorattemptsexhausted']['completionpass'])); } } else { // Fallback. if (!empty($rules['completionattemptsexhausted'])) { $descriptions[] = get_string('completionpassorattemptsexhausteddesc', 'quiz'); - } else if (!empty($rules['completionpass'])) { - $descriptions[] = get_string('completionpassdesc', 'quiz', format_time($rules['completionpass'])); } } diff --git a/mod/quiz/locallib.php b/mod/quiz/locallib.php index 34bc48b1df9..63a9dcab2f7 100644 --- a/mod/quiz/locallib.php +++ b/mod/quiz/locallib.php @@ -1877,7 +1877,7 @@ function quiz_attempt_submitted_handler($event) { // Update completion state. $completion = new completion_info($course); if ($completion->is_enabled($cm) && - ($quiz->completionattemptsexhausted || $quiz->completionpass || $quiz->completionminattempts)) { + ($quiz->completionattemptsexhausted || $quiz->completionminattempts)) { $completion->update_state($cm, COMPLETION_COMPLETE, $event->userid); } return quiz_send_notification_messages($course, $quiz, $attempt, diff --git a/mod/quiz/mod_form.php b/mod/quiz/mod_form.php index 86bf35bdc80..c4ec0461840 100644 --- a/mod/quiz/mod_form.php +++ b/mod/quiz/mod_form.php @@ -527,19 +527,6 @@ class mod_quiz_mod_form extends moodleform_mod { } } - if (array_key_exists('completion', $data) && $data['completion'] == COMPLETION_TRACKING_AUTOMATIC) { - $completionpass = isset($data['completionpass']) ? $data['completionpass'] : $this->current->completionpass; - - // Show an error if require passing grade was selected and the grade to pass was set to 0. - if ($completionpass && (empty($data['gradepass']) || grade_floatval($data['gradepass']) == 0)) { - if (isset($data['completionpass'])) { - $errors['completionpassgroup'] = get_string('gradetopassnotset', 'quiz'); - } else { - $errors['gradepass'] = get_string('gradetopassmustbeset', 'quiz'); - } - } - } - if (!empty($data['completionminattempts'])) { if ($data['attempts'] > 0 && $data['completionminattempts'] > $data['attempts']) { $errors['completionminattemptsgroup'] = get_string('completionminattemptserror', 'quiz'); @@ -615,17 +602,11 @@ class mod_quiz_mod_form extends moodleform_mod { $mform = $this->_form; $items = array(); - $group = array(); - $group[] = $mform->createElement('advcheckbox', 'completionpass', null, get_string('completionpass', 'quiz'), - array('group' => 'cpass')); - $mform->disabledIf('completionpass', 'completionusegrade', 'notchecked'); - $group[] = $mform->createElement('advcheckbox', 'completionattemptsexhausted', null, - get_string('completionattemptsexhausted', 'quiz'), - array('group' => 'cattempts')); - $mform->disabledIf('completionattemptsexhausted', 'completionpass', 'notchecked'); - $mform->addGroup($group, 'completionpassgroup', get_string('completionpass', 'quiz'), '   ', false); - $mform->addHelpButton('completionpassgroup', 'completionpass', 'quiz'); - $items[] = 'completionpassgroup'; + $mform->addElement('advcheckbox', 'completionattemptsexhausted', null, + get_string('completionattemptsexhausted', 'quiz'), + array('group' => 'cattempts')); + $mform->disabledIf('completionattemptsexhausted', 'completionpassgrade', 'notchecked'); + $items[] = 'completionattemptsexhausted'; $group = array(); $group[] = $mform->createElement('checkbox', 'completionminattemptsenabled', '', @@ -648,7 +629,6 @@ class mod_quiz_mod_form extends moodleform_mod { */ public function completion_rule_enabled($data) { return !empty($data['completionattemptsexhausted']) || - !empty($data['completionpass']) || !empty($data['completionminattemptsenabled']); } diff --git a/mod/quiz/tests/behat/completion_condition_attempts_used.feature b/mod/quiz/tests/behat/completion_condition_attempts_used.feature index dea3fc19586..63e3b611b27 100644 --- a/mod/quiz/tests/behat/completion_condition_attempts_used.feature +++ b/mod/quiz/tests/behat/completion_condition_attempts_used.feature @@ -25,8 +25,8 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all | questioncategory | qtype | name | questiontext | | Test questions | truefalse | First question | Answer the first question | And the following "activities" exist: - | activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpass | completionattemptsexhausted | - | quiz | Test quiz name | C1 | quiz1 | 2 | 5.00 | 2 | 1 | 1 | 1 | + | activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpassgrade | completionattemptsexhausted | + | quiz | Test quiz name | C1 | quiz1 | 2 | 5.00 | 2 | 1 | 1 | 1 | And quiz "Test quiz name" contains the following questions: | question | page | | First question | 1 | @@ -37,7 +37,8 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all Scenario: student1 uses up both attempts without passing When I log in as "student1" And I am on "Course 1" course homepage - And the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed" + And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo" And I follow "Test quiz name" And I press "Re-attempt quiz" @@ -45,10 +46,12 @@ Feature: Set a quiz to be marked complete when the student uses all attempts all And I press "Finish attempt ..." And I press "Submit all and finish" And I am on "Course 1" course homepage - Then the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed" + Then the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "done" And I follow "Test quiz name" - And the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed" + And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "done" And I log out And I log in as "teacher1" diff --git a/mod/quiz/tests/behat/completion_condition_passing_grade.feature b/mod/quiz/tests/behat/completion_condition_passing_grade.feature index 4c435129c4f..1ee28b89535 100644 --- a/mod/quiz/tests/behat/completion_condition_passing_grade.feature +++ b/mod/quiz/tests/behat/completion_condition_passing_grade.feature @@ -25,8 +25,8 @@ Feature: Set a quiz to be marked complete when the student passes | questioncategory | qtype | name | questiontext | | Test questions | truefalse | First question | Answer the first question | And the following "activities" exist: - | activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpass | completionview | - | quiz | Test quiz name | C1 | quiz1 | 4 | 5.00 | 2 | 1 | 1 | 1 | + | activity | name | course | idnumber | attempts | gradepass | completion | completionusegrade | completionpassgrade | completionview | + | quiz | Test quiz name | C1 | quiz1 | 4 | 5.00 | 2 | 1 | 1 | 1 | And quiz "Test quiz name" contains the following questions: | question | page | | First question | 1 | @@ -35,18 +35,18 @@ Feature: Set a quiz to be marked complete when the student passes When I log in as "student1" And I am on "Course 1" course homepage And the "Receive a grade" completion condition of "Test quiz name" is displayed as "todo" - And the "Receive a pass grade" completion condition of "Test quiz name" is displayed as "todo" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "todo" And the "View" completion condition of "Test quiz name" is displayed as "todo" And user "student1" has attempted "Test quiz name" with responses: | slot | response | | 1 | True | And I follow "Test quiz name" Then the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" - And the "Receive a pass grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "done" And the "View" completion condition of "Test quiz name" is displayed as "done" And I am on "Course 1" course homepage And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" - And the "Receive a pass grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "done" And the "View" completion condition of "Test quiz name" is displayed as "done" And I log out And I log in as "teacher1" diff --git a/mod/quiz/tests/behat/quiz_activity_completion.feature b/mod/quiz/tests/behat/quiz_activity_completion.feature index 2f6c097b826..63dc6ac21f1 100644 --- a/mod/quiz/tests/behat/quiz_activity_completion.feature +++ b/mod/quiz/tests/behat/quiz_activity_completion.feature @@ -35,7 +35,7 @@ Feature: View activity completion in the quiz activity | completion | 2 | | completionview | 1 | | completionusegrade | 1 | - | completionpass | 1 | + | completionpassgrade | 1 | | completionattemptsexhausted | 1 | | completionminattemptsenabled | 1 | | completionminattempts | 1 | @@ -50,6 +50,7 @@ Feature: View activity completion in the quiz activity And the "View" completion condition of "Test quiz name" is displayed as "done" And the "Make attempts: 1" completion condition of "Test quiz name" is displayed as "todo" And the "Receive a grade" completion condition of "Test quiz name" is displayed as "todo" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "todo" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo" And user "student1" has attempted "Test quiz name" with responses: | slot | response | @@ -58,7 +59,8 @@ Feature: View activity completion in the quiz activity And I follow "Test quiz name" And the "View" completion condition of "Test quiz name" is displayed as "done" And the "Make attempts: 1" completion condition of "Test quiz name" is displayed as "done" - And the "Receive a grade" completion condition of "Test quiz name" is displayed as "failed" + And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "failed" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "todo" And I press "Re-attempt quiz" And I set the field "True" to "1" @@ -68,4 +70,5 @@ Feature: View activity completion in the quiz activity And the "View" completion condition of "Test quiz name" is displayed as "done" And the "Make attempts: 1" completion condition of "Test quiz name" is displayed as "done" And the "Receive a grade" completion condition of "Test quiz name" is displayed as "done" + And the "Receive a passing grade" completion condition of "Test quiz name" is displayed as "done" And the "Receive a pass grade or complete all available attempts" completion condition of "Test quiz name" is displayed as "done" diff --git a/mod/quiz/tests/external_test.php b/mod/quiz/tests/external_test.php index bd4da674d09..70af89ca6f9 100644 --- a/mod/quiz/tests/external_test.php +++ b/mod/quiz/tests/external_test.php @@ -228,6 +228,7 @@ class mod_quiz_external_testcase extends externallib_advanced_testcase { $quiz1->groupingid = 0; $quiz1->hasquestions = 0; $quiz1->hasfeedback = 0; + $quiz1->completionpass = 0; $quiz1->autosaveperiod = get_config('quiz', 'autosaveperiod'); $quiz1->introfiles = []; @@ -239,6 +240,7 @@ class mod_quiz_external_testcase extends externallib_advanced_testcase { $quiz2->groupingid = 0; $quiz2->hasquestions = 0; $quiz2->hasfeedback = 0; + $quiz2->completionpass = 0; $quiz2->autosaveperiod = get_config('quiz', 'autosaveperiod'); $quiz2->introfiles = []; diff --git a/mod/quiz/tests/lib_test.php b/mod/quiz/tests/lib_test.php index c751dffc044..07a349e9fb6 100644 --- a/mod/quiz/tests/lib_test.php +++ b/mod/quiz/tests/lib_test.php @@ -226,7 +226,7 @@ class mod_quiz_lib_testcase extends advanced_testcase { 'qtype' => 'numerical', 'quizoptions' => [ 'completionusegrade' => 1, - 'completionpass' => 1 + 'completionpassgrade' => 1 ] ]); @@ -273,7 +273,7 @@ class mod_quiz_lib_testcase extends advanced_testcase { 'quizoptions' => [ 'attempts' => 2, 'completionusegrade' => 1, - 'completionpass' => 1, + 'completionpassgrade' => 1, 'completionattemptsexhausted' => 1 ] ]); @@ -383,7 +383,7 @@ class mod_quiz_lib_testcase extends advanced_testcase { 'quizoptions' => [ 'attempts' => 2, 'completionusegrade' => 1, - 'completionpass' => 1, + 'completionpassgrade' => 1, 'completionminattemptsenabled' => 1, 'completionminattempts' => 2 ] @@ -1140,8 +1140,8 @@ class mod_quiz_lib_testcase extends advanced_testcase { 'course' => $course->id, 'completion' => 2, 'completionusegrade' => 1, + 'completionpassgrade' => 1, 'completionattemptsexhausted' => 1, - 'completionpass' => 1 ]); $quiz2 = $this->getDataGenerator()->create_module('quiz', [ 'course' => $course->id, @@ -1157,7 +1157,6 @@ class mod_quiz_lib_testcase extends advanced_testcase { $moddefaults = new stdClass(); $moddefaults->customdata = ['customcompletionrules' => [ 'completionattemptsexhausted' => 1, - 'completionpass' => 1 ]]; $moddefaults->completion = 2; diff --git a/mod/quiz/upgrade.txt b/mod/quiz/upgrade.txt index 2a2a047a815..e15a91141df 100644 --- a/mod/quiz/upgrade.txt +++ b/mod/quiz/upgrade.txt @@ -6,6 +6,8 @@ This files describes API changes in the quiz code. - process_finish() in mod/quiz/attemptlib.php - quiz_send_confirmation() in mod/quiz/locallib.php - quiz_send_notification_messages() in mod/quiz/locallib.php +* The completionpass criteria has been moved to core as 'completionpassgrade'. Refer to completion/upgrade.txt for + further information. === 3.11 === diff --git a/mod/quiz/version.php b/mod/quiz/version.php index 218c8dc6621..2ccb6c90770 100644 --- a/mod/quiz/version.php +++ b/mod/quiz/version.php @@ -24,6 +24,6 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2021052502; +$plugin->version = 2021052503; $plugin->requires = 2021052500; $plugin->component = 'mod_quiz';