mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 16:04:25 +02:00
MDL12932 -Random Short-Answer Matching does not display correctly in Item analysis report
This commit is contained in:
parent
fffa8b358f
commit
fa1661c27c
@ -154,6 +154,9 @@ class quiz_report extends quiz_default_report {
|
||||
continue;
|
||||
}
|
||||
$qtype = ($quizquestions[$i]->qtype=='random') ? $states[$i]->options->question->qtype : $quizquestions[$i]->qtype;
|
||||
if($quizquestions[$i]->qtype =='randomsamatch'){
|
||||
$quizquestions[$i]->options =$states[$i]->options ;
|
||||
}
|
||||
$q = get_question_responses($quizquestions[$i], $states[$i]);
|
||||
if (empty($q)){
|
||||
continue;
|
||||
|
@ -246,6 +246,26 @@ class question_randomsamatch_qtype extends question_match_qtype {
|
||||
"AND hidden = '0'" .
|
||||
"AND id NOT IN ($questionsinuse)");
|
||||
}
|
||||
function get_all_responses($question, $state) {
|
||||
$answers = array();
|
||||
if (is_array($question->options->subquestions)) {
|
||||
foreach ($question->options->subquestions as $aid => $answer) {
|
||||
if ($answer->questiontext) {
|
||||
foreach($answer->options->answers as $ans ){
|
||||
$answer->answertext = $ans->answer ;
|
||||
}
|
||||
$r = new stdClass;
|
||||
$r->answer = $answer->questiontext . ": " . $answer->answertext;
|
||||
$r->credit = 1;
|
||||
$answers[$aid] = $r;
|
||||
}
|
||||
}
|
||||
}
|
||||
$result = new stdClass;
|
||||
$result->id = $question->id;
|
||||
$result->responses = $answers;
|
||||
return $result;
|
||||
}
|
||||
|
||||
/// BACKUP FUNCTIONS ////////////////////////////
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user