Skip to content

Commit

Permalink
MDL-56646 assign: use ASSIGN_GRADE_NOT_SET constant
Browse files Browse the repository at this point in the history
  • Loading branch information
xow authored and John Okely committed Aug 28, 2017
1 parent e04be43 commit 2d1075e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions mod/assign/locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
// Special value means allow unlimited attempts.
define('ASSIGN_UNLIMITED_ATTEMPTS', -1);

// Special value means no grade has been set.
define('ASSIGN_GRADE_NOT_SET', -1);

// Grading states.
define('ASSIGN_GRADING_STATUS_GRADED', 'graded');
define('ASSIGN_GRADING_STATUS_NOT_GRADED', 'notgraded');
Expand Down
6 changes: 3 additions & 3 deletions mod/assign/tests/lib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ public function test_assign_rescale_activity_grades_some_unset() {
$data = ['grade' => 50];
$assign->testable_apply_grade_to_user((object)$data, $this->students[0]->id, 0);

// Try getting another students grade. This will give a grade of -1.
// Try getting another students grade. This will give a grade of ASSIGN_GRADE_NOT_SET (-1).
$assign->get_user_grade($this->students[1]->id, true);

// Rescale.
Expand All @@ -680,8 +680,8 @@ public function test_assign_rescale_activity_grades_some_unset() {
$student0grade = $assign->get_user_grade($this->students[0]->id, true);
$student1grade = $assign->get_user_grade($this->students[1]->id, true);

// Make sure the real grade is scaled, but the -1 stays the same.
// Make sure the real grade is scaled, but the ASSIGN_GRADE_NOT_SET stays the same.
$this->assertEquals($student0grade->grade, 5);
$this->assertEquals($student1grade->grade, -1);
$this->assertEquals($student1grade->grade, ASSIGN_GRADE_NOT_SET);
}
}

0 comments on commit 2d1075e

Please sign in to comment.