From 1a9e8542c543b1d4d4d6c67197d2ec3453a7b469 Mon Sep 17 00:00:00 2001 From: Zig Tan Date: Mon, 22 Jan 2018 11:35:52 +0800 Subject: [PATCH] MDL-58006 assign: Reset blindmarking assignments to hidden Fix to reset blindmarking assigments to hidden as part of Course reset with behat test --- mod/assign/locallib.php | 8 +++---- .../tests/behat/assign_course_reset.feature | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 54adce03e3b..4d84daffd7d 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -1130,11 +1130,11 @@ class assign { // Remove all grades from gradebook. require_once($CFG->dirroot.'/mod/assign/lib.php'); assign_reset_gradebook($data->courseid); + } - // Reset revealidentities if both submissions and grades have been reset. - if ($this->get_instance()->blindmarking && $this->get_instance()->revealidentities) { - $DB->set_field('assign', 'revealidentities', 0, array('id' => $this->get_instance()->id)); - } + // Reset revealidentities for assign if blindmarking is enabled. + if ($this->get_instance()->blindmarking) { + $DB->set_field('assign', 'revealidentities', 0, array('id' => $this->get_instance()->id)); } } diff --git a/mod/assign/tests/behat/assign_course_reset.feature b/mod/assign/tests/behat/assign_course_reset.feature index 5fc52cc2322..0ba1b6abc5f 100644 --- a/mod/assign/tests/behat/assign_course_reset.feature +++ b/mod/assign/tests/behat/assign_course_reset.feature @@ -108,3 +108,25 @@ Feature: Assign reset And I follow "Test assignment name" And I navigate to "Group overrides" in current page administration Then I should not see "Group 1" + + Scenario: Use course reset to reset blind marking assignment. + Given I follow "Test assignment name" + And I navigate to "Edit settings" in current page administration + And I set the following fields to these values: + | blindmarking | 1 | + And I press "Save" + When I follow "Test assignment name" + And I navigate to "View all submissions" in current page administration + And I select "Reveal student identities" from the "Grading action" singleselect + And I press "Continue" + And I should see "Sam1 Student1" + And I am on "Course 1" course homepage + When I navigate to "Reset" node in "Course administration" + And I set the following fields to these values: + | Delete all submissions | 1 | + And I press "Reset course" + And I press "Continue" + And I am on "Course 1" course homepage + And I follow "Test assignment name" + And I navigate to "View all submissions" in current page administration + Then I should not see "Sam1 Student1"