Example #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;
 }
Example #2
0
 public function start_attempt(question_attempt_step $step, $variant) {
     $step->set_qt_var('_separators',
             $this->ap->get_point() . '$' . $this->ap->get_separator());
 }