-
Notifications
You must be signed in to change notification settings - Fork 246
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
Row selection for peer reviewer unassigning bypasses current unassign method #7274
Merged
david-yz-liu
merged 25 commits into
MarkUsProject:master
from
hemmatio:peer-review-unassign-row-selection
Dec 1, 2024
Merged
Changes from 20 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
20aa634
indicated error with an inline comment
hemmatio 8f9f4fc
merged in master
hemmatio 9b8a554
added logic in peer_reviews_controller.rb 'unassign' call to follow s…
hemmatio 0395ea2
testcase for successful row unassign
hemmatio 5897d73
added testcases involving row selection error flashes, as well as a m…
hemmatio 35e93d8
removed incorrect signifiers of instance methods from testcase
hemmatio b145503
added testcase for peer review reviewer id getter method
hemmatio 9f3996e
removed deprecated code causing forceful row deletion
hemmatio 8bfba79
removed unnecessary selected_reviewee_group_ids parameter from unassi…
hemmatio 181ec39
updated a test case to run in the correct context block
hemmatio da70fcd
removed unused method, self.delete_all_peer_reviews_for()
hemmatio 6ae354a
marked peer_review instance tests with the necessary hash (#), and ad…
hemmatio 0d6ead5
marked peer_review instance tests with the necessary hash (#), and ad…
hemmatio 1226211
Merge branch 'master' of https://github.com/MarkUsProject/Markus into…
hemmatio 942c6c6
adjusted message flash checking for testcases
hemmatio 625b64d
adjusted message flash checking for testcases
hemmatio 55f5784
updated expected error to be more specific
hemmatio 69cf8ef
updated mixed selection case
hemmatio b770965
updated row selection logic to use sql queries
hemmatio fdf1891
Merge branch 'master' of https://github.com/MarkUsProject/Markus into…
hemmatio 712f2c4
Merge branch 'master' of https://github.com/MarkUsProject/Markus into…
hemmatio 873c34e
updated changelog
hemmatio 85c2028
further refined peer review query
hemmatio dbba456
updated changelog.md
hemmatio 53c38c3
removed unneeded methods get_reviewee_id and get_reviewer_id, as well…
hemmatio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,8 +112,8 @@ def show_result | |
|
||
def assign_groups | ||
@assignment = Assignment.find(params[:assignment_id]) | ||
selected_reviewer_group_ids = params[:selectedReviewerGroupIds] || [] | ||
selected_reviewee_group_ids = params[:selectedRevieweeGroupIds] || [] | ||
selected_reviewer_group_ids = Array(params[:selectedReviewerGroupIds]) || [] | ||
selected_reviewee_group_ids = Array(params[:selectedRevieweeGroupIds]) || [] | ||
reviewers_to_remove_from_reviewees_map = params[:selectedReviewerInRevieweeGroups] || {} | ||
action_string = params[:actionString] | ||
num_groups_for_reviewers = params[:numGroupsToAssign].to_i | ||
|
@@ -157,8 +157,15 @@ def assign_groups | |
return | ||
end | ||
when 'unassign' | ||
deleted_count, undeleted_reviews = PeerReview.unassign(selected_reviewee_group_ids, | ||
reviewers_to_remove_from_reviewees_map) | ||
peer_reviews_filtered = PeerReview.joins(:reviewer, :reviewee) | ||
david-yz-liu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
.where(reviewer: { id: selected_reviewer_group_ids }) | ||
.where(reviewee: { id: selected_reviewee_group_ids }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, these don't need to be separate |
||
peer_reviews_filtered.each do |peer_review| | ||
reviewers_to_remove_from_reviewees_map[peer_review.get_reviewee_id] ||= {} # Initialize if does not exist | ||
reviewers_to_remove_from_reviewees_map[peer_review.get_reviewee_id][peer_review.get_reviewer_id] = true | ||
end | ||
|
||
deleted_count, undeleted_reviews = PeerReview.unassign(reviewers_to_remove_from_reviewees_map) | ||
if !undeleted_reviews.empty? && deleted_count == 0 | ||
flash_now(:error, t('peer_reviews.errors.cannot_unassign_any_reviewers')) | ||
return | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure why adding
Array
is needed here, as this PR isn't changing the front-end at all? If you're having trouble with the tests you've added, you can callArray
in the tests themselves.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's exactly what it was, I was having issues with tests. There seemed to be some cases where the group ids weren't being treated as Arrays, but strangely I did not experience test failures after removing this change.
