Repository navigation
fix: fixed tag searching bug in result_controller file - #8234
Merged
david-yz-liu merged 11 commits intoOct 31, 2026
Merged
Conversation
mrafie1
marked this pull request as draft
October 24, 2026 23:11
Collaborator
Coverage Report for CI Build 40896731321Coverage increased (+0.4%) to 91.462%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
mrafie1
marked this pull request as ready for review
October 25, 2026 15:37
david-yz-liu
left a comment
Collaborator
There was a problem hiding this comment.
Looking at the coverage report, it may be that the shared_examples block that you added to is never actually run. (See https://rspec.info/features/3-13/rspec-core/example-groups/shared-examples/)
This isn't great; please go ahead and address that in this PR.
| # TODO: this should be in the grouping or tag controller | ||
| result = record | ||
| tag = Tag.find(params[:tag_id]) | ||
| tag = current_course.tags.find(params[:tag_id]) |
Collaborator
There was a problem hiding this comment.
I think we can be even more specific in our query by limiting our search to tags where the assessment_id matches the grouping's assessment_id or is nil.
(Same applies below)
…ssment or has no assessment
tests now check for tags that do not belong to the same assignment, which is a larger scope than if tags belong to the same course
… fix/bug-results-controller-tags
Contributor
Author
|
Changes:
|
mrafie1
marked this pull request as draft
October 28, 2026 21:36
mrafie1
marked this pull request as ready for review
October 29, 2026 14:55
david-yz-liu
approved these changes
Oct 31, 2026
david-yz-liu
left a comment
Collaborator
There was a problem hiding this comment.
Nice work, @mrafie1!
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Proposed Changes
Summary: Previously, in the
results_controller.rbfile, the functionsadd_tagandremove_tagusedTag.findto search for tags to add/remove. This causes a bug when a tag that doesn't belong to the course of the item result we are looking at is added/removed.Changes:
current_course.tagsto search for the tags available in the current course that have the same assessment id (or none at all).add_tagandremove_tag.Oct 28 Changes
results_controller_spec.rbfile to utilize a shared example block (shared ta and instructor tests)update_marktest:%w[total subtotal mark_override num_marked mark]blockit { expect(response).to have_http_status(:redirect) }block200 OK, not a redirect.ActiveRecord::RecordNotUnique PG::UniqueViolationerror since we tried to add a second mark with the sameresult_id criterion_id. We fixed this by using test doubles to simulate the race condition, stub the duplicate-cleanup query, and verify thatdestroy_allis called.Screenshots of your changes (if applicable)
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
(Include any questions or comments you have regarding your changes.)