示例#1
0
 /**
  * Analyse all the response data for for all the specified attempts at
  * this question.
  * @param \qubaid_condition $qubaids which attempts to consider.
  * @return analysis_for_question
  */
 public function calculate($qubaids)
 {
     // Load data.
     $dm = new \question_engine_data_mapper();
     $questionattempts = $dm->load_attempts_at_question($this->questiondata->id, $qubaids);
     // Analyse it.
     foreach ($questionattempts as $qa) {
         $responseparts = $qa->classify_response();
         $this->analysis->count_response_parts($responseparts);
     }
     $this->analysis->cache($qubaids, $this->questiondata->id);
     return $this->analysis;
 }
示例#2
0
 /**
  * Analyse all the response data for for all the specified attempts at this question.
  *
  * @param \qubaid_condition $qubaids which attempts to consider.
  * @param string $whichtries         which tries to analyse. Will be one of
  *                                   \question_attempt::FIRST_TRY, LAST_TRY or ALL_TRIES.
  * @return analysis_for_question
  */
 public function calculate($qubaids, $whichtries = \question_attempt::LAST_TRY)
 {
     // Load data.
     $dm = new \question_engine_data_mapper();
     $questionattempts = $dm->load_attempts_at_question($this->questiondata->id, $qubaids);
     // Analyse it.
     foreach ($questionattempts as $qa) {
         $responseparts = $qa->classify_response($whichtries);
         if ($this->breakdownbyvariant) {
             $this->analysis->count_response_parts($qa->get_variant(), $responseparts);
         } else {
             $this->analysis->count_response_parts(1, $responseparts);
         }
     }
     $this->analysis->cache($qubaids, $whichtries, $this->questiondata->id);
     return $this->analysis;
 }