Skip to content
Permalink
Browse files

Merge branch 'MDL-60950-master' of git://github.com/damyon/moodle

  • Loading branch information...
andrewnicols committed Jun 19, 2018
2 parents 68a482e + 994d0da commit 67196d5080961c878fd53dfc861c283fd969e5cd
@@ -244,7 +244,7 @@ public function test_grade_grade_date_restore() {
// Testing the restore of an overridden grade.
list($course, $assign) = $this->create_course_and_module('assign', []);
$cm = $DB->get_record('course_modules', ['course' => $course->id, 'instance' => $assign->id]);
$assignobj = new testable_assign(context_module::instance($cm->id), $cm, $course);
$assignobj = new mod_assign_testable_assign(context_module::instance($cm->id), $cm, $course);
$submission = $assignobj->get_user_submission($USER->id, true);
$grade = $assignobj->get_user_grade($USER->id, true);
$grade->grade = 75;
@@ -300,7 +300,7 @@ public function test_usercompletion_date_restore() {
'completionusegrade' => 1 // Student must receive a grade to complete this activity.
]);
$cm = $DB->get_record('course_modules', ['course' => $course->id, 'instance' => $assign->id]);
$assignobj = new testable_assign(context_module::instance($cm->id), $cm, $course);
$assignobj = new mod_assign_testable_assign(context_module::instance($cm->id), $cm, $course);
$submission = $assignobj->get_user_submission($USER->id, true);
$grade = $assignobj->get_user_grade($USER->id, true);
$grade->grade = 75;
@@ -410,4 +410,4 @@ public function test_question_attempt_steps_date_restore() {
$this->assertEquals($dates['originaldate'], $dates['restoredate']);
}
}
}
}
@@ -277,7 +277,8 @@ public function __construct(assign $assignment,
s.status = :submitted AND
(s.timemodified >= g.timemodified OR g.timemodified IS NULL OR g.grade IS NULL';
if ($this->assignment->get_grade_item()->gradetype == GRADE_TYPE_SCALE) {
// Assignment grade is set to the negative grade scale id when scales are used.
if ($this->assignment->get_instance()->grade < 0) {
// Scale grades are set to -1 when not graded.
$where .= ' OR g.grade = -1';
}
@@ -189,6 +189,40 @@ public function test_get_assign_perpage($maxperpage, $userprefs) {
}
}
/**
* Test filter by requires grading.
*
* This is specifically checking an assignment with no grade to make sure we do not
* get an exception thrown when rendering the grading table for this type of assignment.
*/
public function test_gradingtable_filter_by_requiresgrading_no_grade() {
global $PAGE;
$this->resetAfterTest();
$course = $this->getDataGenerator()->create_course();
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'teacher');
$this->setUser($teacher);
$assign = $this->create_instance($course, [
'assignsubmission_onlinetext_enabled' => 1,
'assignfeedback_comments_enabled' => 0,
'grade' => GRADE_TYPE_NONE
]);
$PAGE->set_url(new moodle_url('/mod/assign/view.php', array(
'id' => $assign->get_course_module()->id,
'action' => 'grading',
)));
// Render the table with the requires grading filter.
$gradingtable = new assign_grading_table($assign, 1, ASSIGN_FILTER_REQUIRE_GRADING, 0, true);
$output = $assign->get_renderer()->render($gradingtable);
// Test that the filter function does not throw errors for assignments with no grade.
$this->assertContains(get_string('nothingtodisplay'), $output);
}
/**
* Test submissions with extension date.
*/
@@ -2748,7 +2782,7 @@ public function test_markerallocation() {
$cm = get_coursemodule_from_instance('assign', $assign->get_instance()->id);
$context = context_module::instance($cm->id);
$assign = new testable_assign($context, $cm, $course);
$assign = new mod_assign_testable_assign($context, $cm, $course);
// Check that other teachers can't view this submission.
$this->setUser($otherteacher);

0 comments on commit 67196d5

Please sign in to comment.
You can’t perform that action at this time.