Esempio n. 1
0
 public function get_correct_response()
 {
     $answer = $this->get_correct_answer();
     if (!$answer) {
         return array();
     }
     $response = array('answer' => str_replace('.', $this->ap->get_point(), $answer->answer));
     if ($this->has_separate_unit_field()) {
         $response['unit'] = $this->ap->get_default_unit();
     } else {
         if ($this->unitdisplay == qtype_numerical::UNITINPUT) {
             $response['answer'] = $this->ap->add_unit($answer->answer);
         }
     }
     return $response;
 }
Esempio n. 2
0
    public function get_correct_response() {
        $answer = $this->get_correct_answer();
        if (!$answer) {
            return array();
        }

        $response = array('answer' => $answer->answer);

        if ($this->unitdisplay == qtype_numerical::UNITSELECT) {
            $response['unit'] = $this->ap->get_default_unit();
        } else if ($this->unitdisplay == qtype_numerical::UNITINPUT) {
            $response['answer'] = $this->ap->add_unit($answer->answer);
        }

        return $response;
    }