mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
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:
parent
c65e968162
commit
fc4a5a2f63
2 changed files with 9 additions and 5 deletions
|
@ -77,7 +77,6 @@
|
|||
|
||||
/// Check to see if they are submitting answers
|
||||
if ($rawanswers = data_submitted()) {
|
||||
add_to_log($course->id, "quiz", "submit", "attempt.php?id=$cm->id", "$quiz->id", $cm->id);
|
||||
|
||||
$rawanswers = (array)$rawanswers;
|
||||
|
||||
|
@ -123,7 +122,10 @@
|
|||
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");
|
||||
print_footer($course);
|
||||
exit;
|
||||
|
@ -154,7 +156,6 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
add_to_log($course->id, "quiz", "attempt", "attempt.php?id=$cm->id", "$quiz->id", $cm->id);
|
||||
|
||||
/// Print the quiz page
|
||||
|
||||
|
@ -167,7 +168,10 @@
|
|||
/// Actually seeing the questions marks the start of an attempt
|
||||
|
||||
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)");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1623,7 +1623,7 @@ function quiz_save_attempt($quiz, $questions, $result, $attemptnum) {
|
|||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return $attempt;
|
||||
}
|
||||
|
||||
function quiz_grade_attempt_question_result($question,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue