Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Product structure refactor #5

Open
adamlewkowicz opened this issue Aug 14, 2019 · 5 comments
Open

Product structure refactor #5

adamlewkowicz opened this issue Aug 14, 2019 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@adamlewkowicz
Copy link
Owner

Example macro data:
image

Proposal structure based on this data:

type Product = {
  carbs: 9.7,
  prots: 3,
  fats: 2.5,
  kcal: 44,
  unit: 'ml' // unit doesn't change between portions, so this field is not needed in each portion
  portions: {
    value: 250
    name: 'glass'
  }[]
}
@adamlewkowicz adamlewkowicz added the documentation Improvements or additions to documentation label Aug 14, 2019
@adamlewkowicz adamlewkowicz changed the title Product portion discussion Product portion structure discussion Aug 14, 2019
@adamlewkowicz
Copy link
Owner Author

How user can measure macro if he knows only weight in grams (not ml in this case)?

@adamlewkowicz
Copy link
Owner Author

Use unit converter? https://github.com/ben-ng/convert-units

@adamlewkowicz
Copy link
Owner Author

@adamlewkowicz
Copy link
Owner Author

type Product = {
  macro: {
    carbs: number
    prots: number
    fats: number
    kcal: number
    unit: 'g' | 'ml'
    productId: number
  }[]
}

@adamlewkowicz adamlewkowicz changed the title Product portion structure discussion Product structure refactor discussion Aug 15, 2019
@adamlewkowicz
Copy link
Owner Author

type Product = {
  macro: {
    carbs: number
    prots: number
    fats: number
    kcal: number
    unit: 'g' | 'ml'
    productId: number
  }[]
  mealProduct: {
    quantity: number
    unit: 'g' | 'ml'
  }
  portions: [
    {
      value: 150
      name: 'glass'
      unit: 'ml'
    }
  ]
}

@adamlewkowicz adamlewkowicz changed the title Product structure refactor discussion Product structure refactor Aug 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant