function quiz_get_score_array in Quiz 8.4
Same name and namespace in other branches
- 8.6 quiz.pages.inc \quiz_get_score_array()
- 8.5 quiz.pages.inc \quiz_get_score_array()
- 6.4 quiz.pages.inc \quiz_get_score_array()
- 7.6 quiz.pages.inc \quiz_get_score_array()
- 7 quiz.pages.inc \quiz_get_score_array()
- 7.4 quiz.pages.inc \quiz_get_score_array()
- 7.5 quiz.pages.inc \quiz_get_score_array()
Returns an array of score information for a quiz
Parameters
unknown_type $rid:
unknown_type $quiz_vid:
unknown_type $is_evaluated:
1 call to quiz_get_score_array()
- quiz_report_form_submit in ./
quiz.pages.inc - Submit the report form
File
- ./
quiz.pages.inc, line 794 - Page callback file for the quiz module.
Code
function quiz_get_score_array($rid, $quiz_vid, $is_evaluated) {
$properties = db_query('SELECT max_score, number_of_random_questions
FROM {quiz_node_properties}
WHERE vid = :vid', array(
':vid' => $quiz_vid,
))
->fetchObject();
$total_score = db_query('SELECT SUM(points_awarded)
FROM (quiz_node_results_answers)
WHERE result_id = :result_id', array(
':result_id' => $rid,
))
->fetchField();
return array(
'question_count' => $properties->number_of_random_questions + _quiz_get_num_always_questions($quiz_vid),
'possible_score' => $properties->max_score,
'numeric_score' => $total_score,
'percentage_score' => $properties->max_score == 0 ? 0 : round($total_score * 100 / $properties->max_score),
'is_evaluated' => $is_evaluated,
);
}