mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-46842 assign: Fix for unit tests - previous patch was completely ignoring manually reopening attempts.
This commit is contained in:
parent
7beb1d8ea3
commit
ab38cb2833
@ -1803,9 +1803,10 @@ class assign {
|
||||
* Update a grade in the grade table for the assignment and in the gradebook.
|
||||
*
|
||||
* @param stdClass $grade a grade record keyed on id
|
||||
* @param bool $reopenattempt If the attempt reopen method is manual, allow another attempt at this assignment.
|
||||
* @return bool true for success
|
||||
*/
|
||||
public function update_grade($grade) {
|
||||
public function update_grade($grade, $reopenattempt = false) {
|
||||
global $DB;
|
||||
|
||||
$grade->timemodified = time();
|
||||
@ -1850,9 +1851,11 @@ class assign {
|
||||
} else {
|
||||
$submission = $this->get_user_submission($grade->userid, false);
|
||||
}
|
||||
$this->reopen_submission_if_required($grade->userid,
|
||||
$submission,
|
||||
false);
|
||||
if ($submission && $submission->attemptnumber == $grade->attemptnumber) {
|
||||
$this->reopen_submission_if_required($grade->userid,
|
||||
$submission,
|
||||
$reopenattempt);
|
||||
}
|
||||
|
||||
// Only push to gradebook if the update is for the latest attempt.
|
||||
// Not the latest attempt.
|
||||
@ -6452,7 +6455,7 @@ class assign {
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->update_grade($grade);
|
||||
$this->update_grade($grade, !empty($formdata->addattempt));
|
||||
// Note the default if not provided for this option is true (e.g. webservices).
|
||||
// This is for backwards compatibility.
|
||||
if (!isset($formdata->sendstudentnotifications) || $formdata->sendstudentnotifications) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user