/** * Retrieve the computed response analysis from the question_response_analysis table. * * @param \qubaid_condition $qubaids which attempts to get cached response analysis for. * @return analysis_for_question|boolean analysis or false if no cached analysis found. */ public function load_cached($qubaids) { global $DB; $timemodified = time() - self::TIME_TO_CACHE; $rows = $DB->get_records_select('question_response_analysis', 'hashcode = ? AND questionid = ? AND timemodified > ?', array($qubaids->get_hash_code(), $this->questiondata->id, $timemodified)); if (!$rows) { return false; } foreach ($rows as $row) { $class = $this->analysis->get_subpart($row->subqid)->get_response_class($row->aid); $class->add_response_and_count($row->response, $row->credit, $row->rcount); } return $this->analysis; }