mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-45127 mod_lesson: Fixed reviewing lesson answers changing the lesson grade.
This commit is contained in:
parent
20685b287d
commit
0aec842e58
@ -94,6 +94,8 @@ if (isset($USER->modattempts[$lesson->id])) {
|
||||
$attempts = $DB->get_records("lesson_attempts", array("lessonid"=>$lesson->id, "userid"=>$USER->id, "retry"=>$nretakes), "timeseen", "id, pageid");
|
||||
$found = false;
|
||||
$temppageid = 0;
|
||||
// Make sure that the newpageid always defaults to something valid.
|
||||
$result->newpageid = LESSON_EOL;
|
||||
foreach($attempts as $attempt) {
|
||||
if ($found && $temppageid != $attempt->pageid) { // now try to find the next page, make sure next few attempts do no belong to current page
|
||||
$result->newpageid = $attempt->pageid;
|
||||
|
@ -1989,12 +1989,17 @@ abstract class lesson_page extends lesson_base {
|
||||
|
||||
$attempt->timeseen = time();
|
||||
// if allow modattempts, then update the old attempt record, otherwise, insert new answer record
|
||||
$userisreviewing = false;
|
||||
if (isset($USER->modattempts[$this->lesson->id])) {
|
||||
$attempt->retry = $nretakes - 1; // they are going through on review, $nretakes will be too high
|
||||
$userisreviewing = true;
|
||||
}
|
||||
|
||||
if ($this->lesson->retake || (!$this->lesson->retake && $nretakes == 0)) {
|
||||
$DB->insert_record("lesson_attempts", $attempt);
|
||||
// Only insert a record if we are not reviewing the lesson.
|
||||
if (!$userisreviewing) {
|
||||
if ($this->lesson->retake || (!$this->lesson->retake && $nretakes == 0)) {
|
||||
$DB->insert_record("lesson_attempts", $attempt);
|
||||
}
|
||||
}
|
||||
// "number of attempts remaining" message if $this->lesson->maxattempts > 1
|
||||
// displaying of message(s) is at the end of page for more ergonomic display
|
||||
|
Loading…
x
Reference in New Issue
Block a user