protected function data_preprocessing_answers($question) {
        $question = parent::data_preprocessing_answers($question);
        if (empty($question->options->answers)) {
            return $question;
        }

        $key = 0;
        foreach ($question->options->answers as $answer) {
            // See comment in the parent method about this hack.
            unset($this->_form->_defaultValues["tolerance[$key]"]);

            $question->tolerance[$key] = $answer->tolerance;
            $key++;
        }

        return $question;
    }
 protected function data_preprocessing_answers($question, $withanswerfiles = false)
 {
     $question = parent::data_preprocessing_answers($question, $withanswerfiles);
     if (empty($question->options->answers)) {
         return $question;
     }
     $key = 0;
     foreach ($question->options->answers as $answer) {
         // See comment in the parent method about this hack.
         unset($this->_form->_defaultValues["tolerance[{$key}]"]);
         unset($this->_form->_defaultValues["tolerancetype[{$key}]"]);
         unset($this->_form->_defaultValues["correctanswerlength[{$key}]"]);
         unset($this->_form->_defaultValues["correctanswerformat[{$key}]"]);
         $question->tolerance[$key] = $answer->tolerance;
         $question->tolerancetype[$key] = $answer->tolerancetype;
         $question->correctanswerlength[$key] = $answer->correctanswerlength;
         $question->correctanswerformat[$key] = $answer->correctanswerformat;
         $key++;
     }
     return $question;
 }
 protected function data_preprocessing_answers($question, $withanswerfiles = false)
 {
     parent::data_preprocessing_answers($question, $withanswerfiles);
     $key = 0;
     foreach ($question->options->answers as $answer) {
         // Prepare the answersound filemanager to display files in draft area.
         $draftitemid = file_get_submitted_draft_itemid('answersound[' . $key . ']');
         file_prepare_draft_area($draftitemid, 1, 'question', 'answersound', $answer->id);
         $question->answersound[$key] = $draftitemid;
         // Prepare the feedbacksound filemanager to display files in draft area.
         $draftitemid = file_get_submitted_draft_itemid('feedbacksound[' . $key . ']');
         file_prepare_draft_area($draftitemid, 1, 'question', 'feedbacksound', $answer->id);
         $question->feedbacksound[$key] = $draftitemid;
         $key++;
     }
     return $question;
 }