FIxed the logging of attempts so that clicking on the link in the log

actually shows you that attempt, rather than opening a new one!
This commit is contained in:
moodler 2004-02-17 12:14:02 +00:00
parent c65e968162
commit fc4a5a2f63
2 changed files with 9 additions and 5 deletions

View file

@ -77,7 +77,6 @@
/// Check to see if they are submitting answers /// Check to see if they are submitting answers
if ($rawanswers = data_submitted()) { if ($rawanswers = data_submitted()) {
add_to_log($course->id, "quiz", "submit", "attempt.php?id=$cm->id", "$quiz->id", $cm->id);
$rawanswers = (array)$rawanswers; $rawanswers = (array)$rawanswers;
@ -123,7 +122,10 @@
error("Could not grade your quiz attempt!"); error("Could not grade your quiz attempt!");
} }
if (! $attempt = quiz_save_attempt($quiz, $questions, $result, $attemptnumber)) { if ($attempt = quiz_save_attempt($quiz, $questions, $result, $attemptnumber)) {
add_to_log($course->id, "quiz", "submit",
"review.php?q=$quiz->id&attempt=$attempt->id", "$quiz->id", $cm->id);
} else {
notice(get_string("alreadysubmitted", "quiz"), "view.php?id=$cm->id"); notice(get_string("alreadysubmitted", "quiz"), "view.php?id=$cm->id");
print_footer($course); print_footer($course);
exit; exit;
@ -154,7 +156,6 @@
exit; exit;
} }
add_to_log($course->id, "quiz", "attempt", "attempt.php?id=$cm->id", "$quiz->id", $cm->id);
/// Print the quiz page /// Print the quiz page
@ -167,7 +168,10 @@
/// Actually seeing the questions marks the start of an attempt /// Actually seeing the questions marks the start of an attempt
if (!$unfinished = quiz_get_user_attempt_unfinished($quiz->id, $USER->id)) { if (!$unfinished = quiz_get_user_attempt_unfinished($quiz->id, $USER->id)) {
if (! quiz_start_attempt($quiz->id, $USER->id, $attemptnumber)) { if ($newattemptid = quiz_start_attempt($quiz->id, $USER->id, $attemptnumber)) {
add_to_log($course->id, "quiz", "attempt",
"review.php?q=$quiz->id&attempt=$newattemptid", "$quiz->id", $cm->id);
} else {
error("Sorry! Could not start the quiz (could not save starting time)"); error("Sorry! Could not start the quiz (could not save starting time)");
} }
} }

View file

@ -1623,7 +1623,7 @@ function quiz_save_attempt($quiz, $questions, $result, $attemptnum) {
return false; return false;
} }
} }
return true; return $attempt;
} }
function quiz_grade_attempt_question_result($question, function quiz_grade_attempt_question_result($question,