Esempio n. 1
0
 /**
  * Get all the WHEN 'x' THEN 'y' terms needed to convert the question_attempt_steps.state
  * column to a summary state. Use this like
  * CASE qas.state {$this->full_states_to_summary_state_sql()} END AS summarystate,
  * @param string SQL fragment.
  */
 protected function full_states_to_summary_state_sql()
 {
     $sql = '';
     foreach (question_state::get_all() as $state) {
         $sql .= "WHEN '{$state}' THEN '{$state->get_summary_state()}'\n";
     }
     return $sql;
 }