Print each chip vendor once, not once per chip - #128
Merged
Conversation
soc_vendors left-joins socs, so it yields one row per SoC. Switching the homepage strip to it -- to stop counting sensor-only makers as silicon we run on -- therefore replaced one bug with a louder one: the strip printed HiSilicon twenty-three times, Ingenic twenty-seven, SigmaStar thirty. distinct on the scope, where the join is. It has one caller, so there is nothing else to reconcile, and a scope named soc_vendors ought to mean one row per vendor regardless of who asks. The test that was supposed to cover this asserted which names appeared and never that each appeared once, and its fixture vendor had a single SoC, so it could not have noticed either way. It now builds a vendor with two chips and asserts the rendered strip has no repeats -- checked against the unfixed scope first, where it fails on exactly that assertion.
PR Summary by QodoDeduplicate chip vendors in the homepage silicon strip
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can reply 'qodo' on any finding to push back, ask questions, or dig deeper |
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.
Reported on dev: the homepage's "Runs on silicon by" strip lists
HiSilicontwenty-three times,Ingenictwenty-seven,SigmaStarthirty.Cause
Mine, in #127. The strip used to read
Vendor.order(:name), which countedsensor-only makers as chip vendors. I moved it to the existing
Vendor.soc_vendorsscope — which is right — but that scope isone row per SoC, not per vendor. So
pluck(:name)returns a vendor'sname once for every chip it makes.
Fix
distincton the scope, where the join is. It has exactly one caller, sothere is nothing else to reconcile, and a scope named
soc_vendorsshouldmean one row per vendor whoever asks.
Why the test did not catch it
It asserted which names appeared and never that each appeared once, and
its fixture vendor had a single SoC — so it could not have told the
difference. It now creates a vendor with two chips and asserts the rendered
strip has no repeats. Checked against the unfixed scope first:
Verification
bin/rails test