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

feat: #511 - displays both 100g and serving, saves the form with the API #910

Merged
merged 17 commits into from
Jan 13, 2022

Conversation

monsieurtanuki
Copy link
Contributor

@monsieurtanuki monsieurtanuki commented Jan 10, 2022

I strongly suggest anyone willing to test it live to switch to TEST env.

Impacted files:

  • app_en.arb: added 3 labels
  • app_fr.arb: added 3 labels
  • knowledge_panels_builder.dart: added TODO comment
  • nutrition_page_loaded.dart:
    • now displays both 100g/serving data at the same time
    • now validates and saves the form with the API

… no API call

Impacted file:
* `nutrition_page_loaded.dart`
@monsieurtanuki
Copy link
Contributor Author

@teolemon What I've just committed matches to your latest remarks:

  • switch on top
  • only one column of data
  • actually, the save button doesn't call the API and just waits 2 seconds (but it might change the product locally)

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

bool _perServing = false;
bool _unspecified = false;
bool _unspecified = false; // TODO(monsieurtanuki): fetch that data from API?
bool _servingOr100g = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is maybe confusing, which value is serving and which is 100g

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I admit that it's not 100% intuitive, but once you've understood the logic you're OK.
I wouldn't use enums for that. Then what? bool _isServing;?
Anyway the story is not over, I'll have numerous opportunities to fix that bool (or replace it altogether).
Thanks for the code review @M123-dev!

Please: if you could also have a look at openfoodfacts/openfoodfacts-dart#362 I could go further (and stop querying the internet systematically).

@monsieurtanuki monsieurtanuki merged commit 165f518 into openfoodfacts:develop Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants