mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +02:00
Merge branch 'MDL-74996-master-1' of https://github.com/HuongNV13/moodle
This commit is contained in:
commit
76a942e8b0
17 changed files with 298 additions and 80 deletions
|
@ -70,7 +70,7 @@ Feature: Award badges based on activity completion
|
||||||
And I set the field "False" to "1"
|
And I set the field "False" to "1"
|
||||||
And I press "Finish attempt ..."
|
And I press "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I log out
|
And I log out
|
||||||
|
|
||||||
And I am on the "Course 1" course page logged in as teacher1
|
And I am on the "Course 1" course page logged in as teacher1
|
||||||
|
@ -97,7 +97,7 @@ Feature: Award badges based on activity completion
|
||||||
And I set the field "False" to "1"
|
And I set the field "False" to "1"
|
||||||
And I press "Finish attempt ..."
|
And I press "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I log out
|
And I log out
|
||||||
|
|
||||||
# Pass grade with student1
|
# Pass grade with student1
|
||||||
|
@ -107,7 +107,7 @@ Feature: Award badges based on activity completion
|
||||||
And I set the field "False" to "0"
|
And I set the field "False" to "0"
|
||||||
And I press "Finish attempt ..."
|
And I press "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I log out
|
And I log out
|
||||||
|
|
||||||
# Enable badge access once all students have completed an activity.
|
# Enable badge access once all students have completed an activity.
|
||||||
|
|
11
mod/quiz/amd/build/submission_confirmation.min.js
vendored
Normal file
11
mod/quiz/amd/build/submission_confirmation.min.js
vendored
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
define("mod_quiz/submission_confirmation",["exports","core/notification","core/prefetch","core/templates","core/str"],(function(_exports,_notification,_prefetch,_templates,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
|
||||||
|
/**
|
||||||
|
* A javascript module to handle submission confirmation for quiz.
|
||||||
|
*
|
||||||
|
* @module mod_quiz/submission_confirmation
|
||||||
|
* @copyright 2022 Huong Nguyen <huongnv13@gmail.com>
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
* @since 4.1
|
||||||
|
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_prefetch=_interopRequireDefault(_prefetch),_templates=_interopRequireDefault(_templates);const SELECTOR_attemptSubmitButton=".path-mod-quiz .btn-finishattempt button",SELECTOR_attemptSubmitForm="form#frm-finishattempt",TEMPLATES_submissionConfirmation="mod_quiz/submission_confirmation";_exports.init=unAnsweredQuestions=>{_prefetch.default.prefetchStrings("core",["submit"]),_prefetch.default.prefetchStrings("core_admin",["confirmation"]),_prefetch.default.prefetchStrings("quiz",["submitallandfinish","submission_confirmation"]),_prefetch.default.prefetchTemplate(TEMPLATES_submissionConfirmation),(unAnsweredQuestions=>{const submitAction=document.querySelector(SELECTOR_attemptSubmitButton);submitAction&&submitAction.addEventListener("click",(async e=>{e.preventDefault();try{await(0,_notification.saveCancelPromise)((0,_str.get_string)("submission_confirmation","quiz"),_templates.default.render(TEMPLATES_submissionConfirmation,{hasunanswered:unAnsweredQuestions>0,totalunanswered:unAnsweredQuestions}),(0,_str.get_string)("submitallandfinish","quiz")),submitAction.closest(SELECTOR_attemptSubmitForm).submit()}catch{return}}))})(unAnsweredQuestions)}}));
|
||||||
|
|
||||||
|
//# sourceMappingURL=submission_confirmation.min.js.map
|
1
mod/quiz/amd/build/submission_confirmation.min.js.map
Normal file
1
mod/quiz/amd/build/submission_confirmation.min.js.map
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"version":3,"file":"submission_confirmation.min.js","sources":["../src/submission_confirmation.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 * A javascript module to handle submission confirmation for quiz.\n *\n * @module mod_quiz/submission_confirmation\n * @copyright 2022 Huong Nguyen <huongnv13@gmail.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n * @since 4.1\n */\n\nimport {saveCancelPromise} from 'core/notification';\nimport Prefetch from 'core/prefetch';\nimport Templates from 'core/templates';\nimport {get_string as getString} from 'core/str';\n\nconst SELECTOR = {\n attemptSubmitButton: '.path-mod-quiz .btn-finishattempt button',\n attemptSubmitForm: 'form#frm-finishattempt',\n};\n\nconst TEMPLATES = {\n submissionConfirmation: 'mod_quiz/submission_confirmation',\n};\n\n/**\n * Register events for attempt submit button.\n * @param {int} unAnsweredQuestions Total number of un-answered questions\n */\nconst registerEventListeners = (unAnsweredQuestions) => {\n const submitAction = document.querySelector(SELECTOR.attemptSubmitButton);\n if (submitAction) {\n submitAction.addEventListener('click', async(e) => {\n e.preventDefault();\n try {\n await saveCancelPromise(\n getString('submission_confirmation', 'quiz'),\n Templates.render(TEMPLATES.submissionConfirmation, {\n hasunanswered: unAnsweredQuestions > 0,\n totalunanswered: unAnsweredQuestions\n }),\n getString('submitallandfinish', 'quiz')\n );\n\n // Save pressed.\n submitAction.closest(SELECTOR.attemptSubmitForm).submit();\n } catch {\n // Cancel pressed.\n return;\n }\n });\n }\n};\n\n/**\n * Initialises.\n * @param {int} unAnsweredQuestions Total number of unanswered questions\n */\nexport const init = (unAnsweredQuestions) => {\n Prefetch.prefetchStrings('core', ['submit']);\n Prefetch.prefetchStrings('core_admin', ['confirmation']);\n Prefetch.prefetchStrings('quiz', ['submitallandfinish', 'submission_confirmation']);\n Prefetch.prefetchTemplate(TEMPLATES.submissionConfirmation);\n registerEventListeners(unAnsweredQuestions);\n};\n"],"names":["SELECTOR","TEMPLATES","unAnsweredQuestions","prefetchStrings","prefetchTemplate","submitAction","document","querySelector","addEventListener","async","e","preventDefault","Templates","render","hasunanswered","totalunanswered","closest","submit","registerEventListeners"],"mappings":";;;;;;;;kLA6BMA,6BACmB,2CADnBA,2BAEiB,yBAGjBC,iCACsB,iDAoCPC,wCACRC,gBAAgB,OAAQ,CAAC,6BACzBA,gBAAgB,aAAc,CAAC,mCAC/BA,gBAAgB,OAAQ,CAAC,qBAAsB,8CAC/CC,iBAAiBH,kCAjCEC,CAAAA,4BACtBG,aAAeC,SAASC,cAAcP,8BACxCK,cACAA,aAAaG,iBAAiB,SAASC,MAAAA,IACnCC,EAAEC,2BAEQ,oCACF,mBAAU,0BAA2B,QACrCC,mBAAUC,OAAOZ,iCAAkC,CAC/Ca,cAAeZ,oBAAsB,EACrCa,gBAAiBb,uBAErB,mBAAU,qBAAsB,SAIpCG,aAAaW,QAAQhB,4BAA4BiB,SACnD,kBAiBVC,CAAuBhB"}
|
78
mod/quiz/amd/src/submission_confirmation.js
Normal file
78
mod/quiz/amd/src/submission_confirmation.js
Normal file
|
@ -0,0 +1,78 @@
|
||||||
|
// 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/>.
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A javascript module to handle submission confirmation for quiz.
|
||||||
|
*
|
||||||
|
* @module mod_quiz/submission_confirmation
|
||||||
|
* @copyright 2022 Huong Nguyen <huongnv13@gmail.com>
|
||||||
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||||
|
* @since 4.1
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {saveCancelPromise} from 'core/notification';
|
||||||
|
import Prefetch from 'core/prefetch';
|
||||||
|
import Templates from 'core/templates';
|
||||||
|
import {get_string as getString} from 'core/str';
|
||||||
|
|
||||||
|
const SELECTOR = {
|
||||||
|
attemptSubmitButton: '.path-mod-quiz .btn-finishattempt button',
|
||||||
|
attemptSubmitForm: 'form#frm-finishattempt',
|
||||||
|
};
|
||||||
|
|
||||||
|
const TEMPLATES = {
|
||||||
|
submissionConfirmation: 'mod_quiz/submission_confirmation',
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register events for attempt submit button.
|
||||||
|
* @param {int} unAnsweredQuestions Total number of un-answered questions
|
||||||
|
*/
|
||||||
|
const registerEventListeners = (unAnsweredQuestions) => {
|
||||||
|
const submitAction = document.querySelector(SELECTOR.attemptSubmitButton);
|
||||||
|
if (submitAction) {
|
||||||
|
submitAction.addEventListener('click', async(e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
try {
|
||||||
|
await saveCancelPromise(
|
||||||
|
getString('submission_confirmation', 'quiz'),
|
||||||
|
Templates.render(TEMPLATES.submissionConfirmation, {
|
||||||
|
hasunanswered: unAnsweredQuestions > 0,
|
||||||
|
totalunanswered: unAnsweredQuestions
|
||||||
|
}),
|
||||||
|
getString('submitallandfinish', 'quiz')
|
||||||
|
);
|
||||||
|
|
||||||
|
// Save pressed.
|
||||||
|
submitAction.closest(SELECTOR.attemptSubmitForm).submit();
|
||||||
|
} catch {
|
||||||
|
// Cancel pressed.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialises.
|
||||||
|
* @param {int} unAnsweredQuestions Total number of unanswered questions
|
||||||
|
*/
|
||||||
|
export const init = (unAnsweredQuestions) => {
|
||||||
|
Prefetch.prefetchStrings('core', ['submit']);
|
||||||
|
Prefetch.prefetchStrings('core_admin', ['confirmation']);
|
||||||
|
Prefetch.prefetchStrings('quiz', ['submitallandfinish', 'submission_confirmation']);
|
||||||
|
Prefetch.prefetchTemplate(TEMPLATES.submissionConfirmation);
|
||||||
|
registerEventListeners(unAnsweredQuestions);
|
||||||
|
};
|
|
@ -2712,6 +2712,22 @@ class quiz_attempt {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the total number of unanswered questions in the attempt.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function get_number_of_unanswered_questions(): int {
|
||||||
|
$totalunanswered = 0;
|
||||||
|
foreach ($this->get_slots() as $slot) {
|
||||||
|
$questionstate = $this->get_question_state($slot);
|
||||||
|
if ($questionstate == question_state::$todo || $questionstate == question_state::$invalid) {
|
||||||
|
$totalunanswered++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $totalunanswered;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -218,7 +218,7 @@ $string['configshufflewithin'] = 'If you enable this option, then the parts maki
|
||||||
$string['configtimelimit'] = 'Default time limit for quizzes in minutes. 0 mean no time limit.';
|
$string['configtimelimit'] = 'Default time limit for quizzes in minutes. 0 mean no time limit.';
|
||||||
$string['configtimelimitsec'] = 'Default time limit for quizzes in seconds. 0 mean no time limit.';
|
$string['configtimelimitsec'] = 'Default time limit for quizzes in seconds. 0 mean no time limit.';
|
||||||
$string['configurerandomquestion'] = 'Configure question';
|
$string['configurerandomquestion'] = 'Configure question';
|
||||||
$string['confirmclose'] = 'Once you submit, you will no longer be able to change your answers for this attempt.';
|
$string['confirmclose'] = 'Once you submit your answers, you won’t be able to change them.';
|
||||||
$string['confirmremovequestion'] = 'Are you sure you want to remove this {$a} question?';
|
$string['confirmremovequestion'] = 'Are you sure you want to remove this {$a} question?';
|
||||||
$string['confirmremovesectionheading'] = 'Are you sure you want to remove the \'{$a}\' section heading?';
|
$string['confirmremovesectionheading'] = 'Are you sure you want to remove the \'{$a}\' section heading?';
|
||||||
$string['confirmserverdelete'] = 'Are you sure you want to remove the server <b>{$a}</b> from the list?';
|
$string['confirmserverdelete'] = 'Are you sure you want to remove the server <b>{$a}</b> from the list?';
|
||||||
|
@ -987,6 +987,8 @@ $string['stateoverdue'] = 'Overdue';
|
||||||
$string['stateoverduedetails'] = 'Must be submitted by {$a}';
|
$string['stateoverduedetails'] = 'Must be submitted by {$a}';
|
||||||
$string['status'] = 'Status';
|
$string['status'] = 'Status';
|
||||||
$string['stoponerror'] = 'Stop on error';
|
$string['stoponerror'] = 'Stop on error';
|
||||||
|
$string['submission_confirmation'] = 'Submit all your answers and finish?';
|
||||||
|
$string['submission_confirmation_unanswered'] = 'Questions without a response: {$a}';
|
||||||
$string['submitallandfinish'] = 'Submit all and finish';
|
$string['submitallandfinish'] = 'Submit all and finish';
|
||||||
$string['subneterror'] = 'Sorry, this quiz has been locked so that it is only accessible from certain locations. Currently your computer is not one of those allowed to use this quiz.';
|
$string['subneterror'] = 'Sorry, this quiz has been locked so that it is only accessible from certain locations. Currently your computer is not one of those allowed to use this quiz.';
|
||||||
$string['subnetnotice'] = 'This quiz has been locked so that it is only accessible from certain locations. Your computer is not on an allowed subnet. As teacher you are allowed to preview anyway.';
|
$string['subnetnotice'] = 'This quiz has been locked so that it is only accessible from certain locations. Your computer is not on an allowed subnet. As teacher you are allowed to preview anyway.';
|
||||||
|
|
|
@ -786,9 +786,15 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||||
new moodle_url($attemptobj->processattempt_url(), $options),
|
new moodle_url($attemptobj->processattempt_url(), $options),
|
||||||
get_string('submitallandfinish', 'quiz'));
|
get_string('submitallandfinish', 'quiz'));
|
||||||
$button->id = 'responseform';
|
$button->id = 'responseform';
|
||||||
|
$button->class = 'btn-finishattempt';
|
||||||
|
$button->formid = 'frm-finishattempt';
|
||||||
if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) {
|
if ($attemptobj->get_state() == quiz_attempt::IN_PROGRESS) {
|
||||||
$button->add_action(new confirm_action(get_string('confirmclose', 'quiz'), null,
|
$totalunanswered = 0;
|
||||||
get_string('submitallandfinish', 'quiz')));
|
if ($attemptobj->get_quiz()->navmethod == 'free') {
|
||||||
|
// Only count the unanswered question if the navigation method is set to free.
|
||||||
|
$totalunanswered = $attemptobj->get_number_of_unanswered_questions();
|
||||||
|
}
|
||||||
|
$this->page->requires->js_call_amd('mod_quiz/submission_confirmation', 'init', [$totalunanswered]);
|
||||||
}
|
}
|
||||||
$button->primary = true;
|
$button->primary = true;
|
||||||
|
|
||||||
|
|
|
@ -205,7 +205,7 @@ Feature: Regrading quiz attempts using the Grades report
|
||||||
And I set the field "True" to "1"
|
And I set the field "True" to "1"
|
||||||
And I click on "Finish attempt ..." "button"
|
And I click on "Finish attempt ..." "button"
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page logged in as teacher
|
And I am on the "Quiz for testing regrading" "mod_quiz > question bank" page logged in as teacher
|
||||||
And I choose "Edit question" action for "TF" in the question bank
|
And I choose "Edit question" action for "TF" in the question bank
|
||||||
And I set the field "Correct answer" to "False"
|
And I set the field "Correct answer" to "False"
|
||||||
|
|
37
mod/quiz/templates/submission_confirmation.mustache
Normal file
37
mod/quiz/templates/submission_confirmation.mustache
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
{{!
|
||||||
|
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/>.
|
||||||
|
}}
|
||||||
|
{{!
|
||||||
|
@template mod_quiz/submission_confirmation
|
||||||
|
|
||||||
|
Submission confirmation dialogue template
|
||||||
|
|
||||||
|
Example context (json):
|
||||||
|
{
|
||||||
|
"hasunanswered": false,
|
||||||
|
"totalunanswered": 0
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
<div class="quiz-submission-confirmation-content">
|
||||||
|
<div class="mb-3">
|
||||||
|
{{#str}} confirmclose, mod_quiz {{/str}}
|
||||||
|
</div>
|
||||||
|
{{#hasunanswered}}
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
{{#str}} submission_confirmation_unanswered, mod_quiz, {{totalunanswered}} {{/str}}
|
||||||
|
</div>
|
||||||
|
{{/hasunanswered}}
|
||||||
|
</div>
|
|
@ -50,7 +50,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
$quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');
|
$quizgenerator = $this->getDataGenerator()->get_plugin_generator('mod_quiz');
|
||||||
|
|
||||||
$quiz = $quizgenerator->create_instance(array('course'=>$SITE->id, 'questionsperpage' => 0, 'grade' => 100.0,
|
$quiz = $quizgenerator->create_instance(array('course'=>$SITE->id, 'questionsperpage' => 0, 'grade' => 100.0,
|
||||||
'sumgrades' => 2));
|
'sumgrades' => 3));
|
||||||
|
|
||||||
// Create a couple of questions.
|
// Create a couple of questions.
|
||||||
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
$questiongenerator = $this->getDataGenerator()->get_plugin_generator('core_question');
|
||||||
|
@ -58,10 +58,12 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
$cat = $questiongenerator->create_question_category();
|
$cat = $questiongenerator->create_question_category();
|
||||||
$saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));
|
$saq = $questiongenerator->create_question('shortanswer', null, array('category' => $cat->id));
|
||||||
$numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));
|
$numq = $questiongenerator->create_question('numerical', null, array('category' => $cat->id));
|
||||||
|
$matchq = $questiongenerator->create_question('match', null, ['category' => $cat->id]);
|
||||||
|
|
||||||
// Add them to the quiz.
|
// Add them to the quiz.
|
||||||
quiz_add_quiz_question($saq->id, $quiz);
|
quiz_add_quiz_question($saq->id, $quiz);
|
||||||
quiz_add_quiz_question($numq->id, $quiz);
|
quiz_add_quiz_question($numq->id, $quiz);
|
||||||
|
quiz_add_quiz_question($matchq->id, $quiz);
|
||||||
|
|
||||||
// Make a user to do the quiz.
|
// Make a user to do the quiz.
|
||||||
$user1 = $this->getDataGenerator()->create_user();
|
$user1 = $this->getDataGenerator()->create_user();
|
||||||
|
@ -76,18 +78,46 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
$attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $user1->id);
|
$attempt = quiz_create_attempt($quizobj, 1, false, $timenow, false, $user1->id);
|
||||||
|
|
||||||
quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow);
|
quiz_start_new_attempt($quizobj, $quba, $attempt, 1, $timenow);
|
||||||
$this->assertEquals('1,2,0', $attempt->layout);
|
$this->assertEquals('1,2,3,0', $attempt->layout);
|
||||||
|
|
||||||
quiz_attempt_save_started($quizobj, $quba, $attempt);
|
quiz_attempt_save_started($quizobj, $quba, $attempt);
|
||||||
|
|
||||||
// Process some responses from the student.
|
// Process some responses from the student.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
// The student has not answered any questions.
|
||||||
|
$this->assertEquals(3, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
$tosubmit = array(1 => array('answer' => 'frog'),
|
$tosubmit = array(1 => array('answer' => 'frog'),
|
||||||
2 => array('answer' => '3.14'));
|
2 => array('answer' => '3.14'));
|
||||||
|
|
||||||
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
|
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
|
||||||
|
// The student has answered two questions, and only one remaining.
|
||||||
|
$this->assertEquals(1, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
|
$tosubmit = [
|
||||||
|
3 => [
|
||||||
|
'frog' => 'amphibian',
|
||||||
|
'cat' => 'mammal',
|
||||||
|
'newt' => ''
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
|
||||||
|
// The student has answered three questions but one is invalid, so there is still one remaining.
|
||||||
|
$this->assertEquals(1, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
|
$tosubmit = [
|
||||||
|
3 => [
|
||||||
|
'frog' => 'amphibian',
|
||||||
|
'cat' => 'mammal',
|
||||||
|
'newt' => 'amphibian'
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
|
||||||
|
// The student has answered three questions, so there are no remaining.
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
// Finish the attempt.
|
// Finish the attempt.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
|
@ -99,11 +129,12 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
|
|
||||||
// Check that results are stored as expected.
|
// Check that results are stored as expected.
|
||||||
$this->assertEquals(1, $attemptobj->get_attempt_number());
|
$this->assertEquals(1, $attemptobj->get_attempt_number());
|
||||||
$this->assertEquals(2, $attemptobj->get_sum_marks());
|
$this->assertEquals(3, $attemptobj->get_sum_marks());
|
||||||
$this->assertEquals(true, $attemptobj->is_finished());
|
$this->assertEquals(true, $attemptobj->is_finished());
|
||||||
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
|
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
|
||||||
$this->assertEquals($user1->id, $attemptobj->get_userid());
|
$this->assertEquals($user1->id, $attemptobj->get_userid());
|
||||||
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
// Check quiz grades.
|
// Check quiz grades.
|
||||||
$grades = quiz_get_user_grades($quiz, $user1->id);
|
$grades = quiz_get_user_grades($quiz, $user1->id);
|
||||||
|
@ -165,6 +196,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
|
|
||||||
// Process some responses from the student.
|
// Process some responses from the student.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
|
$this->assertEquals(1, $attemptobj->get_number_of_unanswered_questions());
|
||||||
$attemptobj->process_submitted_actions($quiz->timeclose - 30 * MINSECS, false, [1 => ['answer' => 'frog']]);
|
$attemptobj->process_submitted_actions($quiz->timeclose - 30 * MINSECS, false, [1 => ['answer' => 'frog']]);
|
||||||
|
|
||||||
// Attempt goes overdue (e.g. if cron ran).
|
// Attempt goes overdue (e.g. if cron ran).
|
||||||
|
@ -178,6 +210,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
$this->assertEquals(0, $attemptobj->get_submitted_date());
|
$this->assertEquals(0, $attemptobj->get_submitted_date());
|
||||||
$this->assertEquals($user->id, $attemptobj->get_userid());
|
$this->assertEquals($user->id, $attemptobj->get_userid());
|
||||||
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
// Student submits the attempt during the grace period.
|
// Student submits the attempt during the grace period.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
|
@ -190,6 +223,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
$this->assertEquals($quiz->timeclose + 30 * MINSECS, $attemptobj->get_submitted_date());
|
$this->assertEquals($quiz->timeclose + 30 * MINSECS, $attemptobj->get_submitted_date());
|
||||||
$this->assertEquals($user->id, $attemptobj->get_userid());
|
$this->assertEquals($user->id, $attemptobj->get_userid());
|
||||||
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_quiz_attempt_walkthrough_close_time_extended_at_last_minute() {
|
public function test_quiz_attempt_walkthrough_close_time_extended_at_last_minute() {
|
||||||
|
@ -291,6 +325,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
// Process some responses from the student.
|
// Process some responses from the student.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(4, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
$tosubmit = array();
|
$tosubmit = array();
|
||||||
$selectedquestionid = $quba->get_question_attempt(1)->get_question_id();
|
$selectedquestionid = $quba->get_question_attempt(1)->get_question_id();
|
||||||
|
@ -307,6 +342,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
// Finish the attempt.
|
// Finish the attempt.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
$attemptobj->process_finish($timenow, false);
|
$attemptobj->process_finish($timenow, false);
|
||||||
|
|
||||||
// Re-load quiz attempt data.
|
// Re-load quiz attempt data.
|
||||||
|
@ -319,6 +355,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
|
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
|
||||||
$this->assertEquals($user1->id, $attemptobj->get_userid());
|
$this->assertEquals($user1->id, $attemptobj->get_userid());
|
||||||
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
// Check quiz grades.
|
// Check quiz grades.
|
||||||
$grades = quiz_get_user_grades($quiz, $user1->id);
|
$grades = quiz_get_user_grades($quiz, $user1->id);
|
||||||
|
@ -389,6 +426,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
// Process some responses from the student.
|
// Process some responses from the student.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertFalse($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(1, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
$tosubmit = array(1 => array('answer' => $correctresponse));
|
$tosubmit = array(1 => array('answer' => $correctresponse));
|
||||||
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
|
$attemptobj->process_submitted_actions($timenow, false, $tosubmit);
|
||||||
|
@ -396,6 +434,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
// Finish the attempt.
|
// Finish the attempt.
|
||||||
$attemptobj = quiz_attempt::create($attempt->id);
|
$attemptobj = quiz_attempt::create($attempt->id);
|
||||||
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
$attemptobj->process_finish($timenow, false);
|
$attemptobj->process_finish($timenow, false);
|
||||||
|
|
||||||
|
@ -409,6 +448,7 @@ class attempt_walkthrough_test extends \advanced_testcase {
|
||||||
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
|
$this->assertEquals($timenow, $attemptobj->get_submitted_date());
|
||||||
$this->assertEquals($user1->id, $attemptobj->get_userid());
|
$this->assertEquals($user1->id, $attemptobj->get_userid());
|
||||||
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
$this->assertTrue($attemptobj->has_response_to_at_least_one_graded_question());
|
||||||
|
$this->assertEquals(0, $attemptobj->get_number_of_unanswered_questions());
|
||||||
|
|
||||||
// Check quiz grades.
|
// Check quiz grades.
|
||||||
$grades = quiz_get_user_grades($this->quizwithvariants, $user1->id);
|
$grades = quiz_get_user_grades($this->quizwithvariants, $user1->id);
|
||||||
|
|
|
@ -46,7 +46,7 @@ Feature: Add a quiz
|
||||||
|
|
||||||
@javascript @skip_chrome_zerosize
|
@javascript @skip_chrome_zerosize
|
||||||
Scenario: Add and configure small quiz and perform an attempt as a student with Javascript enabled
|
Scenario: Add and configure small quiz and perform an attempt as a student with Javascript enabled
|
||||||
Then I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
Then I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I should see "So you think it is true"
|
And I should see "So you think it is true"
|
||||||
And I should see "Thank you, this is the general feedback"
|
And I should see "Thank you, this is the general feedback"
|
||||||
And I should see "The correct answer is 'False'."
|
And I should see "The correct answer is 'False'."
|
||||||
|
|
|
@ -17,21 +17,50 @@ Feature: Attempt a quiz
|
||||||
And the following "question categories" exist:
|
And the following "question categories" exist:
|
||||||
| contextlevel | reference | name |
|
| contextlevel | reference | name |
|
||||||
| Course | C1 | Test questions |
|
| Course | C1 | Test questions |
|
||||||
And the following "activities" exist:
|
And the following "questions" exist:
|
||||||
| activity | name | intro | course | idnumber |
|
|
||||||
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 |
|
|
||||||
|
|
||||||
@javascript
|
|
||||||
Scenario: Attempt a quiz with a single unnamed section, review and re-attempt
|
|
||||||
Given the following "questions" exist:
|
|
||||||
| questioncategory | qtype | name | questiontext |
|
| questioncategory | qtype | name | questiontext |
|
||||||
| Test questions | truefalse | TF1 | First question |
|
| Test questions | truefalse | TF1 | First question |
|
||||||
| Test questions | truefalse | TF2 | Second question |
|
| Test questions | truefalse | TF2 | Second question |
|
||||||
|
| Test questions | truefalse | TF3 | Third question |
|
||||||
|
| Test questions | truefalse | TF4 | Fourth question |
|
||||||
|
| Test questions | truefalse | TF5 | Fifth question |
|
||||||
|
| Test questions | truefalse | TF6 | Sixth question |
|
||||||
|
And the following "activities" exist:
|
||||||
|
| activity | name | intro | course | idnumber | grade | navmethod |
|
||||||
|
| quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | 100 | free |
|
||||||
|
| quiz | Quiz 2 | Quiz 2 description | C1 | quiz2 | 6 | free |
|
||||||
|
| quiz | Quiz 3 | Quiz 3 description | C1 | quiz3 | 100 | free |
|
||||||
|
| quiz | Quiz 4 | Quiz 4 description | C1 | quiz4 | 100 | sequential |
|
||||||
And quiz "Quiz 1" contains the following questions:
|
And quiz "Quiz 1" contains the following questions:
|
||||||
| question | page | maxmark |
|
| question | page | maxmark |
|
||||||
| TF1 | 1 | |
|
| TF1 | 1 | |
|
||||||
| TF2 | 1 | 3.0 |
|
| TF2 | 1 | 3.0 |
|
||||||
And user "student" has attempted "Quiz 1" with responses:
|
And quiz "Quiz 2" contains the following questions:
|
||||||
|
| question | page |
|
||||||
|
| TF1 | 1 |
|
||||||
|
| TF2 | 1 |
|
||||||
|
| TF3 | 2 |
|
||||||
|
| TF4 | 3 |
|
||||||
|
| TF5 | 4 |
|
||||||
|
| TF6 | 4 |
|
||||||
|
And quiz "Quiz 2" contains the following sections:
|
||||||
|
| heading | firstslot | shuffle |
|
||||||
|
| Section 1 | 1 | 0 |
|
||||||
|
| Section 2 | 3 | 0 |
|
||||||
|
| | 4 | 1 |
|
||||||
|
| Section 3 | 5 | 1 |
|
||||||
|
And quiz "Quiz 3" contains the following questions:
|
||||||
|
| question | page |
|
||||||
|
| TF1 | 1 |
|
||||||
|
| TF2 | 2 |
|
||||||
|
And quiz "Quiz 4" contains the following questions:
|
||||||
|
| question | page |
|
||||||
|
| TF1 | 1 |
|
||||||
|
| TF2 | 2 |
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Attempt a quiz with a single unnamed section, review and re-attempt
|
||||||
|
Given user "student" has attempted "Quiz 1" with responses:
|
||||||
| slot | response |
|
| slot | response |
|
||||||
| 1 | True |
|
| 1 | True |
|
||||||
| 2 | False |
|
| 2 | False |
|
||||||
|
@ -49,34 +78,8 @@ Feature: Attempt a quiz
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Attempt a quiz with multiple sections
|
Scenario: Attempt a quiz with multiple sections
|
||||||
Given the following "activities" exist:
|
Given I am on the "Quiz 2" "mod_quiz > View" page logged in as "student"
|
||||||
| activity | name | course | idnumber | grade |
|
When I press "Attempt quiz"
|
||||||
| quiz | Quiz 2 | C1 | quiz2 | 6 |
|
|
||||||
And the following "questions" exist:
|
|
||||||
| questioncategory | qtype | name | questiontext |
|
|
||||||
| Test questions | truefalse | TF1 | First question |
|
|
||||||
| Test questions | truefalse | TF2 | Second question |
|
|
||||||
| Test questions | truefalse | TF3 | Third question |
|
|
||||||
| Test questions | truefalse | TF4 | Fourth question |
|
|
||||||
| Test questions | truefalse | TF5 | Fifth question |
|
|
||||||
| Test questions | truefalse | TF6 | Sixth question |
|
|
||||||
And quiz "Quiz 2" contains the following questions:
|
|
||||||
| question | page |
|
|
||||||
| TF1 | 1 |
|
|
||||||
| TF2 | 1 |
|
|
||||||
| TF3 | 2 |
|
|
||||||
| TF4 | 3 |
|
|
||||||
| TF5 | 4 |
|
|
||||||
| TF6 | 4 |
|
|
||||||
And quiz "Quiz 2" contains the following sections:
|
|
||||||
| heading | firstslot | shuffle |
|
|
||||||
| Section 1 | 1 | 0 |
|
|
||||||
| Section 2 | 3 | 0 |
|
|
||||||
| | 4 | 1 |
|
|
||||||
| Section 3 | 5 | 1 |
|
|
||||||
|
|
||||||
When I am on the "Quiz 2" "mod_quiz > View" page logged in as "student"
|
|
||||||
And I press "Attempt quiz"
|
|
||||||
|
|
||||||
Then I should see "Section 1" in the "Quiz navigation" "block"
|
Then I should see "Section 1" in the "Quiz navigation" "block"
|
||||||
And I should see question "1" in section "Section 1" in the quiz navigation
|
And I should see question "1" in section "Section 1" in the quiz navigation
|
||||||
|
@ -100,7 +103,7 @@ Feature: Attempt a quiz
|
||||||
And I should see "Section 3" in the "quizsummaryofattempt" "table"
|
And I should see "Section 3" in the "quizsummaryofattempt" "table"
|
||||||
|
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I should see "1.00 out of 6.00 (16.67%)" in the "Grade" "table_row"
|
And I should see "1.00 out of 6.00 (16.67%)" in the "Grade" "table_row"
|
||||||
And I should see question "1" in section "Section 1" in the quiz navigation
|
And I should see question "1" in section "Section 1" in the quiz navigation
|
||||||
And I should see question "2" in section "Section 1" in the quiz navigation
|
And I should see question "2" in section "Section 1" in the quiz navigation
|
||||||
|
@ -121,40 +124,62 @@ Feature: Attempt a quiz
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: Next and previous navigation
|
Scenario: Next and previous navigation
|
||||||
Given the following "questions" exist:
|
Given I am on the "Quiz 3" "mod_quiz > View" page logged in as "student"
|
||||||
| questioncategory | qtype | name | questiontext |
|
When I press "Attempt quiz"
|
||||||
| Test questions | truefalse | TF1 | Text of the first question |
|
Then I should see "First question"
|
||||||
| Test questions | truefalse | TF2 | Text of the second question |
|
And I should not see "Second question"
|
||||||
And quiz "Quiz 1" contains the following questions:
|
|
||||||
| question | page |
|
|
||||||
| TF1 | 1 |
|
|
||||||
| TF2 | 2 |
|
|
||||||
When I am on the "Quiz 1" "mod_quiz > View" page logged in as "student"
|
|
||||||
And I press "Attempt quiz"
|
|
||||||
Then I should see "Text of the first question"
|
|
||||||
And I should not see "Text of the second question"
|
|
||||||
And I press "Next page"
|
And I press "Next page"
|
||||||
And I should see "Text of the second question"
|
And I should see "Second question"
|
||||||
And I should not see "Text of the first question"
|
And I should not see "First question"
|
||||||
And I click on "Finish attempt ..." "button" in the "region-main" "region"
|
And I click on "Finish attempt ..." "button" in the "region-main" "region"
|
||||||
And I should see "Summary of attempt"
|
And I should see "Summary of attempt"
|
||||||
And I press "Return to attempt"
|
And I press "Return to attempt"
|
||||||
And I should see "Text of the second question"
|
And I should see "Second question"
|
||||||
And I should not see "Text of the first question"
|
And I should not see "First question"
|
||||||
And I press "Previous page"
|
And I press "Previous page"
|
||||||
And I should see "Text of the first question"
|
And I should see "First question"
|
||||||
And I should not see "Text of the second question"
|
And I should not see "Second question"
|
||||||
And I follow "Finish attempt ..."
|
And I follow "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I should see "Once you submit your answers, you won’t be able to change them." in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I should see "Text of the first question"
|
And I should see "Questions without a response: 2" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I should see "Text of the second question"
|
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
|
And I should see "First question"
|
||||||
|
And I should see "Second question"
|
||||||
And I follow "Show one page at a time"
|
And I follow "Show one page at a time"
|
||||||
And I should see "Text of the first question"
|
And I should see "First question"
|
||||||
And I should not see "Text of the second question"
|
And I should not see "Second question"
|
||||||
And I follow "Next page"
|
And I follow "Next page"
|
||||||
And I should see "Text of the second question"
|
And I should see "Second question"
|
||||||
And I should not see "Text of the first question"
|
And I should not see "First question"
|
||||||
And I follow "Previous page"
|
And I follow "Previous page"
|
||||||
And I should see "Text of the first question"
|
And I should see "First question"
|
||||||
And I should not see "Text of the second question"
|
And I should not see "Second question"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: Next and previous with sequential navigation method
|
||||||
|
Given I am on the "Quiz 4" "mod_quiz > View" page logged in as "student"
|
||||||
|
When I press "Attempt quiz"
|
||||||
|
Then I should see "First question"
|
||||||
|
And I should not see "Second question"
|
||||||
|
And I press "Next page"
|
||||||
|
And I should see "Second question"
|
||||||
|
And I should not see "First question"
|
||||||
|
And "Previous page" "button" should not exist
|
||||||
|
And I click on "Finish attempt ..." "button" in the "region-main" "region"
|
||||||
|
And I should see "Summary of attempt"
|
||||||
|
And I press "Submit all and finish"
|
||||||
|
And I should see "Once you submit your answers, you won’t be able to change them." in the "Submit all your answers and finish?" "dialogue"
|
||||||
|
And I should not see "Questions without a response: 2" in the "Submit all your answers and finish?" "dialogue"
|
||||||
|
And I click on "Submit" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
|
And I should see "First question"
|
||||||
|
And I should see "Second question"
|
||||||
|
And I follow "Show one page at a time"
|
||||||
|
And I should see "First question"
|
||||||
|
And I should not see "Second question"
|
||||||
|
And I follow "Next page"
|
||||||
|
And I should see "Second question"
|
||||||
|
And I should not see "First question"
|
||||||
|
And I follow "Previous page"
|
||||||
|
And I should see "First question"
|
||||||
|
And I should not see "Second question"
|
||||||
|
|
|
@ -96,7 +96,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||||
And I click on "Check" "button" in the "First question" "question"
|
And I click on "Check" "button" in the "First question" "question"
|
||||||
And I press "Finish attempt ..."
|
And I press "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
Then "Try another question like this one" "button" should not exist
|
Then "Try another question like this one" "button" should not exist
|
||||||
|
|
||||||
@javascript @_switch_window
|
@javascript @_switch_window
|
||||||
|
@ -108,7 +108,7 @@ Feature: Allow students to redo questions in a practice quiz, without starting a
|
||||||
And I press "Try another question like this one"
|
And I press "Try another question like this one"
|
||||||
And I press "Finish attempt ..."
|
And I press "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I log out
|
And I log out
|
||||||
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
|
And I am on the "Quiz 1" "mod_quiz > View" page logged in as "teacher"
|
||||||
And I follow "Attempts: 1"
|
And I follow "Attempts: 1"
|
||||||
|
|
|
@ -91,7 +91,7 @@ Feature: Attempt a quiz where some questions require that the previous question
|
||||||
And I press "Attempt quiz"
|
And I press "Attempt quiz"
|
||||||
And I press "Finish attempt ..."
|
And I press "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
|
|
||||||
Then the state of "First question" question is shown as "Not answered"
|
Then the state of "First question" question is shown as "Not answered"
|
||||||
And the state of "Second question" question is shown as "Not answered"
|
And the state of "Second question" question is shown as "Not answered"
|
||||||
|
|
|
@ -33,7 +33,7 @@ Feature: Teachers see correct answers when overriding marks
|
||||||
And I set the field "Answer" to "lion"
|
And I set the field "Answer" to "lion"
|
||||||
And I follow "Finish attempt ..."
|
And I follow "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I log out
|
And I log out
|
||||||
|
|
||||||
@javascript @_switch_window @_bug_phantomjs
|
@javascript @_switch_window @_bug_phantomjs
|
||||||
|
|
|
@ -35,7 +35,7 @@ Feature: Teachers can override the grade for any question
|
||||||
And I press "Attempt quiz"
|
And I press "Attempt quiz"
|
||||||
And I follow "Finish attempt ..."
|
And I follow "Finish attempt ..."
|
||||||
And I press "Submit all and finish"
|
And I press "Submit all and finish"
|
||||||
And I click on "Submit all and finish" "button" in the "Confirmation" "dialogue"
|
And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue"
|
||||||
And I log out
|
And I log out
|
||||||
|
|
||||||
@javascript @_switch_window @_bug_phantomjs
|
@javascript @_switch_window @_bug_phantomjs
|
||||||
|
|
|
@ -16,6 +16,8 @@ related to out of sequence question except while reviewing the quiz (MDL-75210).
|
||||||
internal method of the quiz_overview plugin. But if you are incorrectly using it, be aware
|
internal method of the quiz_overview plugin. But if you are incorrectly using it, be aware
|
||||||
that the API changed slightly. It now returns an array listing any questions which could
|
that the API changed slightly. It now returns an array listing any questions which could
|
||||||
not be regraded.
|
not be regraded.
|
||||||
|
* New method called get_number_of_unanswered_questions() has been added to mod/quiz/attemptlib.php
|
||||||
|
to get the total number of unanswered questions in the current attempt.
|
||||||
|
|
||||||
=== 4.0 ===
|
=== 4.0 ===
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue