Repository navigation
fix(import): Lose It amounts are portions, not servings - #334
Open
jayhemnani9910 wants to merge 1 commit into
Open
jayhemnani9910 wants to merge 1 commit into
jayhemnani9910 wants to merge 1 commit into
Conversation
Lose It's Calories and nutrient columns are the totals for the logged amount, but the importer stored that amount (50 grams) as the serving count, which the diary multiplies by: 50 g of oats came in as 9,250 kcal. Store one serving with the amount and unit as the portion, like the Cronometer and spreadsheet importers.
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.
The Lose It! import multiplies each entry's calories by its logged amount. With rows from a real Lose It food-log export:
the oats are stored as quantity 50 with 185 kcal per serving, so the diary counts 9,250 kcal. The day comes to 38,355 kcal instead of 406.
Lose It's Calories and nutrient columns are already the totals for the logged amount.
parseLoseitput that amount intoquantity, whichNutrition.calculatemultiplies by. It now emitsquantity: 1with the amount asportionand the unit asunit, the shape the Cronometer and spreadsheet importers already use for the same reason.Added
scripts/nutrition-import-loseit.test.jswith the oats row; it fails without the change.node --test scripts/*.test.jsshows the same 18 failures with and without the change.