mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
MDL-48861 assign: Fix unit tests and behat tests
The tests were not working with the change to the needs grading filter.
This commit is contained in:
parent
ee58df52da
commit
fb6bae3eae
@ -6703,6 +6703,7 @@ class assign {
|
||||
global $USER, $CFG, $DB;
|
||||
|
||||
$grade = $this->get_user_grade($userid, true, $attemptnumber);
|
||||
$originalgrade = $grade->grade;
|
||||
$gradingdisabled = $this->grading_disabled($userid);
|
||||
$gradinginstance = $this->get_grading_instance($userid, $grade, $gradingdisabled);
|
||||
if (!$gradingdisabled) {
|
||||
@ -6747,7 +6748,12 @@ class assign {
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->update_grade($grade, !empty($formdata->addattempt));
|
||||
// We do not want to update the timemodified if no grade was added.
|
||||
if (!empty($formdata->addattempt) ||
|
||||
($originalgrade !== null && $originalgrade != -1) ||
|
||||
($grade->grade !== null && $grade->grade != -1)) {
|
||||
$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) {
|
||||
|
@ -778,6 +778,8 @@ class mod_assign_locallib_testcase extends mod_assign_base_testcase {
|
||||
$plugin = $assign1->get_submission_plugin_by_type('onlinetext');
|
||||
$plugin->save($submission, $data);
|
||||
|
||||
// Wait 1 second so the submission and grade do not have the same timemodified.
|
||||
sleep(1);
|
||||
// Simulate adding a grade.
|
||||
$this->setUser($this->teachers[0]);
|
||||
$data = new stdClass();
|
||||
|
Loading…
x
Reference in New Issue
Block a user