Fix bug that skips rendering single contributors #279
Merged
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.
Our rendering of contributors from TIMDEX apparently has a bug that skips rendering anything if there is only one contributor on the record. This appears to be caused by our use of
.uniqin the rendering partial, because there is an optimization with Ruby's handling of.uniqthat skips entirely an entity with only one element (because all it's doing is trying to define unique elements, and a list of one element is by definition unique).Adding an
.eachcall to this construct forces the iteration to take place, separating the filtering step from the iterator.Relevant ticket
https://mitlibraries.atlassian.net/browse/use-214
To confirm this behavior
Compare a search for
archiveson the TIMDEX tab, between the production app and this review app. The 11th result and the 16th result should show a single contributor on the review app, while being blank in production.Document any side effects to this change
Hopefully none.
Please note:
I've chosen note to update any tests for this fix, but I'm not certain this is the correct choice. This is a view-layer behavior, so we don't normally have tests like this, but not having a test like this caused us to miss this in the first place.
Developer
Accessibility
New ENV
Approval beyond code review
Additional context needed to review
E.g., if the PR includes updated dependencies and/or data
migration, or how to confirm the feature is working.
Code Reviewer
Code
added technical debt.
Documentation
(not just this pull request message).
Testing