We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi everyone,
Currently, we don't check what is in the nutrition screen, whereas on the website we have multiple checks.
The content you are editing has changed. Please copy your edits and refresh the page.
The text was updated successfully, but these errors were encountered:
Energy should not exceed 3800 kJ
Yes it should: I eat what I want to eat! 😉
Sorry, something went wrong.
Asked Gemini Advanced to give it a first jab
import 'dart:math'; /// Check the relation between kJ and kCal bool isValidEnergyRelation(double kJ, double kCal) { // The relation should be approximately 4.184 kJ per kCal double expectedKCal = kJ / 4.184; return (kCal - expectedKCal).abs() <= 0.1; // Allow small tolerance } /// Ensure energy does not exceed 3800 kJ bool isValidEnergy(double kJ) { return kJ <= 3800; } /// Ensure fat does not exceed 100g bool isValidFat(double fat) { return fat <= 100; } /// Ensure saturated fat does not exceed total fat bool isValidSaturatedFat(double saturatedFat, double fat) { return saturatedFat <= fat; } /// Ensure carbohydrates do not exceed 100g bool isValidCarbohydrates(double carbohydrates) { return carbohydrates <= 100; } /// Ensure sugars do not exceed total carbohydrates bool isValidSugars(double sugars, double carbohydrates) { return sugars <= carbohydrates; } /// Ensure fibers do not exceed 100g bool isValidFibers(double fibers) { return fibers <= 100; } /// Ensure proteins do not exceed 100g bool isValidProteins(double proteins) { return proteins <= 100; } /// Compute sodium from salt and check if it's valid double computeSodium(double salt) { return salt * 0.393; // 39.3% of salt is sodium } bool isValidSalt(double salt) { return salt <= 2.5; } /// Generic function to check if a nutrient does not exceed 100g bool isValidNutrient(double nutrient) { return nutrient <= 100; }
No branches or pull requests
Hi everyone,
Currently, we don't check what is in the nutrition screen, whereas on the website we have multiple checks.
Tasks
The text was updated successfully, but these errors were encountered: