Repository navigation
fix(library): cards fall back to computed OG, FG, ABV, IBU and color (#49) - #66
Merged
Merged
Conversation
…49) Recipe cards only showed the figures stored in the file: OG, FG and ABV read "—" when the file lacked them, IBU showed "—" with the estimate as a small subtitle, and the color swatch only appeared with a stored color_estimate. The recipe screen already showed Werb's estimates in that case, so a recipe like the Punk IPA sample (OG/FG only) looked incomplete in the library. - data/recipe-targets.ts: claimed + computed OG, FG, ABV and SRM, same rules as the recipe screen (OG from the grain bill, FG from attenuation, ABV from the shown OG/FG). An empty grain bill gives no estimate rather than 1.000. - RecipeCard: shows the file value, else the estimate; IBU keeps the "≈estimate" subtitle when the file states one. Exported for tests. Tests: recipe-targets unit tests, RecipeCard component tests, e2e on the Punk IPA sample card.
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.
Closes #49 (reopen if the reporter meant another screen).
Why
Library cards only showed the figures stored in the recipe file. OG, FG and ABV read "—" when the file lacked them, IBU showed "—" with the estimate as a small subtitle, and the color swatch needed a stored
color_estimate. The recipe screen already shows Werb's estimates in that case, so a recipe like the Punk IPA sample (OG/FG only) looked incomplete in the library: the "preview missing DI/DF/ABV" report.What
data/recipe-targets.ts: claimed + computed OG, FG, ABV and SRM, same rules as the recipe screen (OG from the grain bill, FG from attenuation, ABV from the shown OG/FG). An empty grain bill gives no estimate rather than 1.000.RecipeCard: file value, else the estimate. IBU keeps its "≈estimate" subtitle when the file states one. Exported for tests; stats carrydata-testids.Tests
recipe-targets(file first, estimates, empty grain bill).RecipeCardrenders estimates for Punk IPA, file values for Cascade, dashes with nothing to estimate from.