-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add the new nutrient order and list
API for edit mode
#210
Comments
nutrient order and list
API for edit mode
@teolemon Correct me if I'm wrong, but should we rely on the order only, or on the structure of this file? |
mmh…here's the canonical structure server side: https://github.com/openfoodfacts/openfoodfacts-server/blob/c71f8bec679c0de005f6ff65f8e3f05ee18a272f/lib/ProductOpener/Food.pm#L480 |
If we focus just on omega3, there's an incoherence between your OP: {
"display_in_edit_form": false,
"id": "omega-3-fat",
"important": false,
"name": "Acides gras Oméga 3"
},
{
"display_in_edit_form": false,
"important": false,
"id": "alpha-linolenic-acid",
"name": "Acide alpha-linolénique / ALA (18:3 n-3)"
},
{
"important": false,
"id": "eicosapentaenoic-acid",
"name": "Acide eicosapentaénoïque / EPA (20:5 n-3)",
"display_in_edit_form": false
},
{
"name": "Acide docosahexaénoïque / DHA (22:6 n-3)",
"important": false,
"id": "docosahexaenoic-acid",
"display_in_edit_form": false
}, ... and the canonical form: '-omega-3-fat-',
'--alpha-linolenic-acid-',
'--eicosapentaenoic-acid-',
'--docosahexaenoic-acid-', The order is the same, but the level shouldn't be the same between omega3 and its "children". |
I've just finished my loader (about to PR), and the structure still looks fishy in all 3 cases... https://fr.openfoodfacts.org/cgi/nutrients.plenergy-kj https://us.openfoodfacts.org/cgi/nutrients.plenergy-kcal https://us-es.openfoodfacts.org/cgi/nutrients.plenergy-kcal |
@monsieurtanuki you are right, it is broken indeed. I filed a bug on the server: openfoodfacts/openfoodfacts-server#5997 Thanks a lot for the report. |
New files: * `ordered_nutrient_test.dart`: Tests related to `OrderedNutrient` and `OrderedNutrients` * `OrderedNutrient.dart`: Nutrient, as a hierarchically ordered and localized entity. * `OrderedNutrients.dart`: Nutrients, as hierarchically ordered and localized entities. Generated files (from JsonSerializable): * `OrderedNutrient.g.dart` * `OrderedNutrients.g.dart`
…oring Thanks to @peterwvj and @jasmeet0817! Impacted files: * `ordered_nutrient_test.dart`: added a comment, removed commented code * `OrderedNutrient.dart`: simplified around JsonSerializable * `OrderedNutrient.g.dart` (generated from JsonSerializable) * `OrderedNutrients.dart`: simplified around JsonSerializable * `OrderedNutrients.g.dart` (generated from JsonSerializable)
Thanks to @peterwvj and @jasmeet0817! New files: * `ordered_nutrient_test.dart`: Tests related to `OrderedNutrient` and `OrderedNutrients` * `OrderedNutrient.dart`: Nutrient, as a hierarchically ordered and localized entity. * `OrderedNutrients.dart`: Nutrients, as hierarchically ordered and localized entities. Generated files (from JsonSerializable): * `OrderedNutrient.g.dart` * `OrderedNutrients.g.dart`
Impacted files: * `openfoodfacts.dart`: created method `getOrderedNutrients` * `ordered_nutrient_test.dart`: used new method `OpenFoodAPIClient.getOrderedNutrients`; refactored
Impacted files: * `openfoodfacts.dart`: created method `getOrderedNutrients` * `ordered_nutrient_test.dart`: used new method `OpenFoodAPIClient.getOrderedNutrients`; refactored
Done in #272. |
What
Nutrient order and list changes based on country:
https://fr.openfoodfacts.org/cgi/nutrients.pl
https://us.openfoodfacts.org/cgi/nutrients.pl
https://us-es.openfoodfacts.org/cgi/nutrients.pl
I had forgotten about this nice API for the edit mode (and potentially for view mode for the nutrition table)
Part of
Code sample
The text was updated successfully, but these errors were encountered: