|
@ -2013,17 +2013,23 @@ function game_grade_questions( $questions) |
|
|
$id = game_question_get_id_from_name_prefix( $key); |
|
|
$id = game_question_get_id_from_name_prefix( $key); |
|
|
if( $id === false) |
|
|
if( $id === false) |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
|
|
|
$grade = new stdClass(); |
|
|
if( array_key_exists( $id, $grades)) |
|
|
$grade->id = $id; |
|
|
$grade = $grades[ $id]; |
|
|
$grade->response = $value; |
|
|
else |
|
|
$grade->grade = 0; |
|
|
{ |
|
|
|
|
|
$grade = new stdClass(); |
|
|
|
|
|
$grade->grade = 0; |
|
|
|
|
|
$grade->id = $id; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$grade->response = $value; |
|
|
|
|
|
|
|
|
$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) |
|
@ -2034,7 +2040,7 @@ function game_grade_questions( $questions) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$grades[ $grade->id] = $grade; |
|
|
$grades[ $grade->id] = $grade; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|