diff --git a/mod/assign/lib.php b/mod/assign/lib.php index d79fbce00f4..6799d5404c7 100644 --- a/mod/assign/lib.php +++ b/mod/assign/lib.php @@ -404,7 +404,8 @@ function assign_print_overview($courses, &$htmlarray) { g.attemptnumber = s.attemptnumber WHERE ( g.timemodified is NULL OR - s.timemodified > g.timemodified ) AND + s.timemodified > g.timemodified OR + g.grade IS NULL ) AND s.timemodified IS NOT NULL AND s.status = ? AND s.latest = 1 AND diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 46b5e2aaba3..38d03f0daa6 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -1506,7 +1506,7 @@ class assign { s.assignment = :assignid AND s.timemodified IS NOT NULL AND s.status = :submitted AND - (s.timemodified > g.timemodified OR g.timemodified IS NULL)'; + (s.timemodified > g.timemodified OR g.timemodified IS NULL OR g.grade IS NULL)'; return $DB->count_records_sql($sql, $params); } diff --git a/mod/assign/tests/behat/quickgrading.feature b/mod/assign/tests/behat/quickgrading.feature index f9765c76d62..fa968b37547 100644 --- a/mod/assign/tests/behat/quickgrading.feature +++ b/mod/assign/tests/behat/quickgrading.feature @@ -4,6 +4,45 @@ Feature: In an assignment, teachers grade multiple students on one page As a teacher I need to grade multiple students on one page + Scenario: Saving but not grading a grade should + not indicate the grade is graded. + Given the following "courses" exist: + | fullname | shortname | category | groupmode | + | Course 1 | C1 | 0 | 1 | + And the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@asd.com | + | student1 | Student | 1 | student1@asd.com | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + When I log in as "admin" + And I follow "Course 1" + And I turn editing mode on + And I add a "Assignment" to section "1" and I fill the form with: + | Assignment name | Test assignment name | + | Description | Submit your online text | + | assignsubmission_onlinetext_enabled | 1 | + And I log out + And I log in as "student1" + And I follow "Course 1" + And I follow "Test assignment name" + And I press "Add submission" + And I set the following fields to these values: + | Online text | I'm the student1 submission | + And I press "Save changes" + And I log out + And I log in as "admin" + And I follow "Course 1" + And I follow "Test assignment name" + And I follow "View/grade all submissions" + And I click on "Grade Student 1" "link" in the "Student 1" "table_row" + And I press "Save changes" + And I press "Continue" + And I follow "Test assignment name" + Then I should see "1" in the "Needs grading" "table_row" + @javascript Scenario: Grade multiple students on one page Given the following "courses" exist: