function _quiz_delete_old_in_progress in Quiz 7
Same name and namespace in other branches
- 8.4 quiz.module \_quiz_delete_old_in_progress()
- 6.4 quiz.module \_quiz_delete_old_in_progress()
- 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 3082 - Quiz Module
Code
function _quiz_delete_old_in_progress($quiz, $uid) {
$res = db_query('SELECT qnr.result_id FROM {quiz_node_results} qnr
WHERE qnr.uid = :uid
AND qnr.nid = :nid
AND qnr.time_end = :time_end
AND qnr.vid < :vid', array(
':uid' => $uid,
':nid' => $quiz->nid,
':time_end' => 1,
':vid' => $quiz->vid,
));
$rids = array();
while ($rids[] = $res
->fetchField()) {
}
quiz_delete_results($rids);
}