-
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
Optimize Empty Submission Querying in graders_controller #7381
Merged
david-yz-liu
merged 9 commits into
MarkUsProject:master
from
hemmatio:assign-grader-querying
Jan 25, 2025
+36
β4
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
a60e37c
refactored filter_empty_submissions method to prevent unnecessary queβ¦
hemmatio 436ac31
updated changelog
hemmatio 8961d58
merge from master
hemmatio 5ccd9a0
move everything into one query
hemmatio faf4e42
changed plucking to only return grouping id column
hemmatio b1a5b4e
Merge branch 'master' of https://github.com/MarkUsProject/Markus intoβ¦
hemmatio f091e34
created test to confirm correct values of filter_empty_submissions
hemmatio da3b194
Merge branch 'master' of https://github.com/MarkUsProject/Markus intoβ¦
hemmatio bfe2211
updated test case to confirm behaviour of assign action when found_emβ¦
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
Next
Next commit
refactored filter_empty_submissions method to prevent unnecessary queβ¦
β¦rying
commit a60e37ceb3712491e5dd1868cc5cc58954c8f315
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 |
---|---|---|
|
@@ -253,10 +253,10 @@ def unassign_graders(grouping_ids, grader_ids) | |
|
||
# Returns array of grouping ids with non empty submissions | ||
def filter_empty_submissions(grouping_ids) | ||
grouping_ids.select do |grouping_id| | ||
submission = Submission.find_by(grouping_id: grouping_id, submission_version_used: true) | ||
submission && !submission.is_empty | ||
end | ||
submissions = Submission.where(grouping_id: grouping_ids, submission_version_used: true) | ||
.pluck(:grouping_id, :is_empty) | ||
non_empty_grouping_ids = submissions.reject { |_, is_empty| is_empty }.map { |grouping_id, _| grouping_id.to_s } | ||
non_empty_grouping_ids & grouping_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. The |
||
end | ||
|
||
def filter_grouping_by_section(section_assignments, assignment) | ||
|
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.
The
reject
is awkward here; instead, you can move theis_empty
check into the.where
method above.