|
@ -2014,16 +2014,22 @@ function game_grade_questions( $questions) |
|
|
if( $id === false) |
|
|
if( $id === false) |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
|
|
|
$grade = new stdClass(); |
|
|
if( array_key_exists( $id, $grades)) |
|
|
$grade->id = $id; |
|
|
$grade = $grades[ $id]; |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
$grade = new stdClass(); |
|
|
|
|
|
$grade->grade = 0; |
|
|
|
|
|
$grade->id = $id; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
$grade->response = $value; |
|
|
$grade->response = $value; |
|
|
$grade->grade = 0; |
|
|
|
|
|
|
|
|
|
|
|
$question = $questions[ $id]; |
|
|
$question = $questions[ $id]; |
|
|
if( $question->qtype == 'multichoice') |
|
|
if( $question->qtype == 'multichoice') |
|
|
{ |
|
|
{ |
|
|
$answer = $question->options->answers[ $value]; |
|
|
$answer = $question->options->answers[ $value]; |
|
|
$grade->grade = $answer->fraction; |
|
|
$grade->grade += $answer->fraction; |
|
|
}else if( $question->qtype == 'shortanswer') |
|
|
}else if( $question->qtype == 'shortanswer') |
|
|
{ |
|
|
{ |
|
|
foreach( $question->options->answers as $answerid => $answer) |
|
|
foreach( $question->options->answers as $answerid => $answer) |
|
|