public function shortanswerStatement($translatorevent, $questionAttempt, $question) {

        $translatorevent['interaction_type'] = 'fill-in';
        $translatorevent['interaction_correct_responses'] = [];

        foreach ($question->answers as $answer) {
            if (intval($answer->fraction) === 1) {
                $correctResponse;
                if ($question->shortanswer->options->usecase == '1') {
                    $correctResponse = '{case_matters=true}'.$answer->answer;
                } else {
                    $correctResponse = '{case_matters=false}'.$answer->answer;
                }
                array_push($translatorevent['interaction_correct_responses'], $correctResponse);
            }
        }

        return $translatorevent;
    }
public function shortanswerStatement($translatorevent, $questionAttempt, $question) {

        $translatorevent['interaction_type'] = 'fill-in';
        $translatorevent['interaction_correct_responses'] = [];

        foreach ($question->answers as $answer) {
            if (intval($answer->fraction) === 1) {
                $correctResponse;
                if ($question->shortanswer->options->usecase == '1') {
                    $correctResponse = '{case_matters=true}'.$answer->answer;
                } else {
                    $correctResponse = '{case_matters=false}'.$answer->answer;
                }
                array_push($translatorevent['interaction_correct_responses'], $correctResponse);
            }
        }

        return $translatorevent;
    }
public function shortanswerStatement ( $ translatorevent , $ questionAttempt , $ question ) { $ translatorevent [ 'interaction_type' ] = 'fill-in' ; $ translatorevent [ 'interaction_correct_responses' ] = [ ] ; foreach ( $ question -> answers as $ answer ) { if ( intval ( $ answer -> fraction ) === 1 ) { $ correctResponse ; if ( $ question -> shortanswer -> options -> usecase == '1' ) { $ correctResponse = '{case_matters=true}' . $ answer -> answer ; } else { $ correctResponse = '{case_matters=false}' . $ answer -> answer ; } array_push ( $ translatorevent [ 'interaction_correct_responses' ] , $ correctResponse ) ; } } return $ translatorevent ; }
Add data specifc to shortanswer question types to a translator event.
@param [String => Mixed] $translatorevent
@param PHPObj $questionAttempt
@param PHPObj $question
@return [String => Mixed]
Add data specifc to shortanswer question types to a translator event .