function quiz_update_6419 in Quiz 6.4
Implementation of hook_update_N
Makes sure max_score is correct in the quiz_node_properties
File
- ./
quiz.install, line 132 - Quiz install schema for installing the quiz module
Code
function quiz_update_6419() {
$results = array();
$sql = "UPDATE {quiz_node_properties} p\n LEFT OUTER JOIN (\n SELECT parent_vid, COALESCE(SUM(max_score), 0) AS ms\n FROM {quiz_node_relationship} r\n WHERE r.question_status = 1\n GROUP BY parent_vid\n ) t ON t.parent_vid = p.vid\n SET p.max_score = p.max_score_for_random * p.number_of_random_questions + COALESCE(t.ms, 0)";
$results[] = update_sql($sql);
return $results;
}