Skip to content

Commit

Permalink
CTP-3783 sampling tests
Browse files Browse the repository at this point in the history
  • Loading branch information
watson8 committed Oct 28, 2024
1 parent 48bd4fe commit 3bd2ff4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 3 additions & 0 deletions classes/allocation/manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ public function save_sample() {

global $DB;
$DB->delete_records('coursework_sample_set_rules', ['courseworkid' => $this->coursework->id]);
// We also need to clear the cache.
// We get an error in behat @mod_coursework_sampling_range_set_rules if not as user not in cached sample for assessor 2.
\mod_coursework\models\assessment_set_membership::remove_cache($this->coursework->id);
for ($i = 2; $i <= $this->coursework->get_max_markers(); $i++) {

$samplestrategy = required_param("assessor_{$i}_samplingstrategy", PARAM_INT);
Expand Down
6 changes: 5 additions & 1 deletion tests/behat/sampling_manual_sampling.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@mod @mod_coursework
@mod @mod_coursework @mod_coursework_sampling_manual
Feature: Manual sampling

As a teacher
Expand All @@ -22,15 +22,18 @@ Feature: Manual sampling
And the submission deadline has passed
And the submission is finalised

@javascript
Scenario: Manual sampling should include student when selected
When I visit the allocations page
And I select a student as a part of the sample for the second stage
And I save everything
And I log out
And I log in as the teacher
And I visit the coursework page
And I wait "1" seconds
Then I should be able to add the second grade for this student

@javascript
Scenario: Manual sampling should not include student when not selected
When I visit the allocations page
And I deselect a student as a part of the sample for the second stage
Expand All @@ -40,6 +43,7 @@ Feature: Manual sampling
And I visit the coursework page
Then I should not be able to add the second grade for this student

@javascript
Scenario: Single grade should go to the gradebook column when only first stage is in sample
When I visit the allocations page
And I deselect a student as a part of the sample for the second stage
Expand Down
6 changes: 3 additions & 3 deletions tests/behat/sampling_sample_range_set_rules.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ Feature: Automatic sample based on range set grades using marking of students in
And I expand the coursework grading row 1
And I wait "1" seconds
And I click on the new feedback button for assessor 2
# TODO The line above fails because the row for assessor 2 is not shown. Instead it says "Not included in sample".
And I grade the submission as 60 using the simple form
And I grade the submission as 60 using the ajax form
And I visit the coursework page
And I expand the coursework grading row 2
And I click on the new feedback button for assessor 2 for another student
And I grade the submission as 40 using the simple form
And I grade the submission as 40 using the ajax form
And I log out
And I am logged in as a manager
And I visit the allocations page
Expand Down

0 comments on commit 3bd2ff4

Please sign in to comment.