Merge branch 'MDL-58628-master' of git://github.com/jleyva/moodle

This commit is contained in:
David Monllao 2017-04-27 12:19:20 +08:00
commit aabee00d58
2 changed files with 14 additions and 15 deletions

View file

@ -110,7 +110,11 @@ class mod_quiz_external extends external_api {
$quizdetails['introfiles'] = external_util::get_area_files($context->id, 'mod_quiz', 'intro', false, false); $quizdetails['introfiles'] = external_util::get_area_files($context->id, 'mod_quiz', 'intro', false, false);
$viewablefields = array('timeopen', 'timeclose', 'grademethod', 'section', 'visible', 'groupmode', $viewablefields = array('timeopen', 'timeclose', 'grademethod', 'section', 'visible', 'groupmode',
'groupingid'); 'groupingid', 'attempts', 'timelimit', 'grademethod', 'decimalpoints',
'questiondecimalpoints', 'sumgrades', 'grade', 'preferredbehaviour');
// Some times this function returns just empty.
$hasfeedback = quiz_has_feedback($quiz);
$quizdetails['hasfeedback'] = (!empty($hasfeedback)) ? 1 : 0;
$timenow = time(); $timenow = time();
$quizobj = quiz::create($quiz->id, $USER->id); $quizobj = quiz::create($quiz->id, $USER->id);
@ -119,20 +123,15 @@ class mod_quiz_external extends external_api {
// Fields the user could see if have access to the quiz. // Fields the user could see if have access to the quiz.
if (!$accessmanager->prevent_access()) { if (!$accessmanager->prevent_access()) {
// Some times this function returns just empty.
$hasfeedback = quiz_has_feedback($quiz);
$quizdetails['hasfeedback'] = (!empty($hasfeedback)) ? 1 : 0;
$quizdetails['hasquestions'] = (int) $quizobj->has_questions(); $quizdetails['hasquestions'] = (int) $quizobj->has_questions();
$quizdetails['autosaveperiod'] = get_config('quiz', 'autosaveperiod'); $quizdetails['autosaveperiod'] = get_config('quiz', 'autosaveperiod');
$additionalfields = array('timelimit', 'attempts', 'attemptonlast', 'grademethod', 'decimalpoints', $additionalfields = array('attemptonlast', 'reviewattempt', 'reviewcorrectness', 'reviewmarks',
'questiondecimalpoints', 'reviewattempt', 'reviewcorrectness', 'reviewmarks',
'reviewspecificfeedback', 'reviewgeneralfeedback', 'reviewrightanswer', 'reviewspecificfeedback', 'reviewgeneralfeedback', 'reviewrightanswer',
'reviewoverallfeedback', 'questionsperpage', 'navmethod', 'sumgrades', 'grade', 'reviewoverallfeedback', 'questionsperpage', 'navmethod',
'browsersecurity', 'delay1', 'delay2', 'showuserpicture', 'showblocks', 'browsersecurity', 'delay1', 'delay2', 'showuserpicture', 'showblocks',
'completionattemptsexhausted', 'completionpass', 'overduehandling', 'completionattemptsexhausted', 'completionpass', 'overduehandling',
'graceperiod', 'preferredbehaviour', 'canredoquestions', 'graceperiod', 'canredoquestions', 'allowofflineattempts');
'allowofflineattempts');
$viewablefields = array_merge($viewablefields, $additionalfields); $viewablefields = array_merge($viewablefields, $additionalfields);
} }

View file

@ -192,15 +192,15 @@ class mod_quiz_external_testcase extends externallib_advanced_testcase {
// Create what we expect to be returned when querying the two courses. // Create what we expect to be returned when querying the two courses.
// First for the student user. // First for the student user.
$allusersfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles', 'timeopen', $allusersfields = array('id', 'coursemodule', 'course', 'name', 'intro', 'introformat', 'introfiles', 'timeopen',
'timeclose', 'grademethod', 'section', 'visible', 'groupmode', 'groupingid'); 'timeclose', 'grademethod', 'section', 'visible', 'groupmode', 'groupingid',
$userswithaccessfields = array('timelimit', 'attempts', 'attemptonlast', 'grademethod', 'decimalpoints', 'attempts', 'timelimit', 'grademethod', 'decimalpoints', 'questiondecimalpoints', 'sumgrades',
'questiondecimalpoints', 'reviewattempt', 'reviewcorrectness', 'reviewmarks', 'grade', 'preferredbehaviour', 'hasfeedback');
$userswithaccessfields = array('attemptonlast', 'reviewattempt', 'reviewcorrectness', 'reviewmarks',
'reviewspecificfeedback', 'reviewgeneralfeedback', 'reviewrightanswer', 'reviewspecificfeedback', 'reviewgeneralfeedback', 'reviewrightanswer',
'reviewoverallfeedback', 'questionsperpage', 'navmethod', 'sumgrades', 'grade', 'reviewoverallfeedback', 'questionsperpage', 'navmethod',
'browsersecurity', 'delay1', 'delay2', 'showuserpicture', 'showblocks', 'browsersecurity', 'delay1', 'delay2', 'showuserpicture', 'showblocks',
'completionattemptsexhausted', 'completionpass', 'autosaveperiod', 'hasquestions', 'completionattemptsexhausted', 'completionpass', 'autosaveperiod', 'hasquestions',
'hasfeedback', 'overduehandling', 'graceperiod', 'preferredbehaviour', 'canredoquestions', 'overduehandling', 'graceperiod', 'canredoquestions', 'allowofflineattempts');
'allowofflineattempts');
$managerfields = array('shuffleanswers', 'timecreated', 'timemodified', 'password', 'subnet'); $managerfields = array('shuffleanswers', 'timecreated', 'timemodified', 'password', 'subnet');
// Add expected coursemodule and other data. // Add expected coursemodule and other data.