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

change unit_to_g() to unit_to_default_unit() ? #1665

Open
Tracked by #5527
hangy opened this issue Feb 16, 2019 · 2 comments
Open
Tracked by #5527

change unit_to_g() to unit_to_default_unit() ? #1665

hangy opened this issue Feb 16, 2019 · 2 comments
Assignees

Comments

@hangy
Copy link
Member

hangy commented Feb 16, 2019

$unit eq 'kcal' and return int($value * 4.184 + 0.5);
$unit eq 'kcal' and return int($value / 4.184 + 0.5);
Apparently, 1 cal = 4.184 J, but why would it make sense to calculate unit_to_g(1, 'kcal') to 4.684 g? Wouldn't this need to use 9 g for fat and 4 g for protein and carbohydrates?

@stephanegigandet
Copy link
Contributor

The function should be named unit_to_default_unit, which is g for pretty much everything, except energy where it's J.

@teolemon teolemon changed the title kcal to g change unit_to_g() to unit_to_default_unit() ? Jan 10, 2020
@teolemon
Copy link
Member

Renaming to make it clearer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: To discuss and validate
Development

No branches or pull requests

3 participants