Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: allow annotations on parent assignments with released peer reviews #7222

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
### 🐛 Bug fixes
- Fix incorrect calculation of token penalties when submissions are on time (#7216)
- Fix JSON/CSV summary of test results to always be inline with latest test run (#7214)
- Allow annotations to be added to results with released peer reviews (#7222)

### 🔧 Internal changes

Expand Down
2 changes: 1 addition & 1 deletion app/models/annotation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def get_data(include_creator: false)

# check if the submission file is associated with a remark result or a released result
def check_if_released
annotation_results = result.submission.results
annotation_results = result.submission.non_pr_results

return if is_remark && annotation_results.where.not(remark_request_submitted_at: nil)
.where('results.released_to_students': false)
Expand Down
26 changes: 26 additions & 0 deletions spec/models/annotation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,32 @@
expect { create(:text_annotation) }.not_to raise_error
end
end

context 'with a peer review' do
let!(:assignment) { create(:assignment_with_peer_review_and_groupings_results) }
let(:selected_reviewer_group_ids) { assignment.pr_assignment.groupings }
let(:selected_reviewee_group_ids) { assignment.groupings }

before do
PeerReview.create_peer_review_between(selected_reviewer_group_ids[0],
selected_reviewee_group_ids[1])
PeerReview.create_peer_review_between(selected_reviewer_group_ids[1],
selected_reviewee_group_ids[2])
PeerReview.create_peer_review_between(selected_reviewer_group_ids[2],
selected_reviewee_group_ids[0])
assignment.peer_reviews.each do |peer_review|
peer_review.result.update!(marking_state: 'complete', released_to_students: true)
end
end

context 'with a released peer review result and unreleased original result' do
let(:unreleased_result) { assignment.groupings.first.current_result }

it 'should allow an annotation to be created' do
expect { create(:text_annotation, result: unreleased_result) }.not_to raise_error
end
end
end
end

context 'destroying annotations' do
Expand Down