You are here

function _quiz_delete_old_in_progress in Quiz 6.4

Same name and namespace in other branches
  1. 8.4 quiz.module \_quiz_delete_old_in_progress()
  2. 7 quiz.module \_quiz_delete_old_in_progress()
  3. 7.4 quiz.module \_quiz_delete_old_in_progress()

Delete quiz responses for quizzes that haven't been finished.

Parameters

$quiz: A quiz node where old in progress results shall be deleted.

$uid: The userid of the user the old in progress results belong to.

1 call to _quiz_delete_old_in_progress()
quiz_take_quiz in ./quiz.module
Handles quiz taking.

File

./quiz.module, line 2975
Quiz Module

Code

function _quiz_delete_old_in_progress($quiz, $uid) {
  $sql = "SELECT qnr.result_id\n          FROM {quiz_node_results} qnr\n          WHERE qnr.uid = %d\n          AND qnr.nid = %d\n          AND qnr.time_end = 0\n          AND qnr.vid < %d";
  $res = db_query($sql, $uid, $quiz->nid, $quiz->vid);
  $rids = array();
  while ($rids[] = db_result($res)) {
  }
  quiz_delete_results($rids);
}