From fd19b4eb6bc3f89e63835185d36011da19927035 Mon Sep 17 00:00:00 2001 From: amandadoughty Date: Tue, 24 Dec 2024 12:22:46 +0000 Subject: [PATCH] #13 fix for 4.2 --- classes/completion/custom_completion.php | 4 ++-- tests/behat/activitycompletion.feature | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/classes/completion/custom_completion.php b/classes/completion/custom_completion.php index 0959407..b150f45 100644 --- a/classes/completion/custom_completion.php +++ b/classes/completion/custom_completion.php @@ -59,8 +59,8 @@ protected function check_graded_peers(): bool { $peers = peerwork_get_peers($course, $peerwork, $peerwork->pwgroupingid, $groupid, $this->userid); $gradedcount = $DB->count_records_select( 'peerwork_peers', - 'peerwork = ?', - [$peerwork->id], + 'peerwork = ? AND gradedby = ?', + [$peerwork->id, $this->userid], 'COUNT(DISTINCT gradefor)' ); return count($peers) <= $gradedcount; diff --git a/tests/behat/activitycompletion.feature b/tests/behat/activitycompletion.feature index 5f2f80f..b9d0bd2 100644 --- a/tests/behat/activitycompletion.feature +++ b/tests/behat/activitycompletion.feature @@ -57,15 +57,15 @@ Feature: Assignment completion @javascript Scenario: Students who grades every peer is shown as completed When I am on "Course 1" course homepage - And "Done" "button" should exist in the "Test peerwork name" "activity" + And "Done: Grade peers in group" "text" should exist in the "Test peerwork name" "activity" And I log out @javascript Scenario: Students who has not graded every peer is not shown as completed And I log in as "student2" When I am on "Course 1" course homepage - And "Done" "button" should not exist in the "Test peerwork name" "activity" - And "To do" "button" should exist in the "Test peerwork name" "activity" + And "Done: Grade peers in group" "text" should not exist in the "Test peerwork name" "activity" + And "To do: Grade peers in group" "text" should exist in the "Test peerwork name" "activity" And I log out @javascript