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

Calories in kcal vs kJ #13

Open
Blackoverflow opened this issue Jul 18, 2022 · 2 comments
Open

Calories in kcal vs kJ #13

Blackoverflow opened this issue Jul 18, 2022 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Blackoverflow
Copy link

Blackoverflow commented Jul 18, 2022

The recommended calories seem to be calculated in kcal but the calories given for a scanned foot item (Fritz-Kola EAN 4260107220015) seem to be in kJ.

How it is:

  1. No units are displayed for calorie values.
  2. Calorie values in different units are subtracted by the kalTracker.

What I wish for:

  1. It would be nice to have the unit of values displayed.
  2. All calculations should be done with values in the same unit (maybe kcal, because that feels to be the commonly used unit).
@ivoxavier ivoxavier self-assigned this Jul 18, 2022
@ivoxavier ivoxavier added the enhancement New feature or request label Jul 18, 2022
@ivoxavier
Copy link
Owner

Hi Blackoverflow, thank you for your feedback. I will improve this in future releases

@c0d3xd3v
Copy link

c0d3xd3v commented Jul 1, 2024

I think it is realy a bug, some items add kcal some kj. I have investigated the openfood api and we can filter out the kcal numbers to compute right. I think it musst be here :

qml/components/IsProductFoundDialog.qml

{
            var _json = openFoodFactJSON.model.get(0);
            if (typeof _json !== "undefined" && typeof _json.product_name !== "undefined" ) {
                logical_fields.ingestion.product_name = _json.product_name
                logical_fields.ingestion.nutriscore = (typeof _json.nutriscore_grade == "undefined") ? "a" :  _json.nutriscore_grade
                logical_fields.ingestion.cal = (typeof _json.nutriments.energy_value == "undefined") ? 0 : _json.nutriments.energy_value
                logical_fields.ingestion.fat = (typeof _json.nutriments.fat_100g == "undefined") ? 0.0 : _json.nutriments.fat_100g
                logical_fields.ingestion.protein = (typeof _json.nutriments.proteins_100g == "undefined") ? 0.0 : _json.nutriments.proteins_100g
                logical_fields.ingestion.carbo = (typeof _json.nutriments.carbohydrates_100g == "undefined") ? 0.0 : _json.nutriments.carbohydrates_100g
                logical_fields.ingestion.nova_groups = (typeof _json.nova_groups == "undefined") ? "0" : _json.nova_groups
                next_button.enabled = true
                loading_circle.running = false
                loading_circle.visible = false
            }else{
                loading_circle.running = false
                loading_circle.visible = false
                enter_manually.visible = true
                is_code_empty = true
            }
        }
    }

the _json.nutriments.energy_value to not contain kcal consistently so we can use energy-kcal , energy-kcal_100g that holds the needed kcal value. but i do not know right now how to extract it from _json.nutriments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants