original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: 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
docstring_tokens: Analyse all the response data for for all the specified attempts at this question .