You are here

function _quiz_get_attempt_count in Quiz 6.4

Same name and namespace in other branches
  1. 8.6 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  2. 8.4 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  3. 8.5 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  4. 6.6 includes/quiz_dashboard/quiz_dashboard.admin.inc \_quiz_get_attempt_count()
  5. 7.6 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  6. 7 includes/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  7. 7.4 includes/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  8. 7.5 modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()
  9. 6.x modules/quiz_stats/quiz_stats.admin.inc \_quiz_get_attempt_count()

Computes quiz attempt count

Parameters

$vid: quiz revision id

$uid: user id for filtering

Return value

Integer containing number of times that a quiz has been attended, can be filtered by uid.

1 call to _quiz_get_attempt_count()
theme_quiz_stats_get_basic_stats in includes/quiz_stats/quiz_stats.admin.inc
Generates table of results from quiz data structure.

File

includes/quiz_stats/quiz_stats.admin.inc, line 253

Code

function _quiz_get_attempt_count($vid, $uid = 0) {
  $sql = "SELECT COUNT(result_id) FROM {quiz_node_results} WHERE nid = %d";
  if ($uid != 0) {
    $sql .= " AND uid = %d";
  }
  return db_result(db_query($sql, $vid, $uid));
}