-
-
Notifications
You must be signed in to change notification settings - Fork 313
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
fix: #3046 - refactored NutritionPage around Nutrient #3194
fix: #3046 - refactored NutritionPage around Nutrient #3194
Conversation
New file: * `nutrition_add_nutrient_button.dart`: Button that opens an "add nutrient" dialog. Impacted files: * `nutrition_container.dart`: heavy refactoring using `Nutrient` instead of `String` ids * `nutrition_page_loaded.dart`: now using `Nutrient` instead of `String` ids * `portion_helper.dart`: now using new `nutriments.getValue` instead of json map trick * `product_query.dart`: added fields `NUTRIMENT_DATA_PER` and `NUTRITION_DATA` * `app/pubspec.lock`: wtf * `smooth_app/pubspec.lock`: wtf * `pubspec.yaml`: upgraded to `openfoodfacts: 1.26.2`
packages/app/pubspec.lock
Outdated
url: "https://pub.dartlang.org" | ||
source: hosted | ||
version: "1.26.0" | ||
path: "../../../openfoodfacts-dart" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incoherence with smooth_app/pubspec.yaml
.
Impacted file: * `registration_login_test.dart`: unrelated test fix after off-dart upgrade
Codecov Report
@@ Coverage Diff @@
## develop #3194 +/- ##
==========================================
+ Coverage 6.19% 6.22% +0.03%
==========================================
Files 252 253 +1
Lines 12519 12458 -61
==========================================
Hits 776 776
+ Misses 11743 11682 -61
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heyy @monsieurtanuki looks all good to me, although you are probably the only one who really knows about the nutrition management in smoothie 😆
Just the pubspec.lock should be fixed
packages/app/pubspec.lock
Outdated
name: openfoodfacts | ||
url: "https://pub.dartlang.org" | ||
source: hosted | ||
version: "1.26.0" | ||
path: "../../../openfoodfacts-dart" | ||
relative: true | ||
source: path | ||
version: "1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this will very likely break deployment, can you run pub get again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
/// Button that opens an "add nutrient" dialog. | ||
/// | ||
/// The code was moved here in order to declutter [NutritionPageLoaded]. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like that but I don't think this comment is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. I've removed the comment.
I guess next time I'll put it in a "TODO: remove - just for the review!" comment
Impacted files: * `nutrition_add_nutrient_button.dart`: removed unnecessary comment * `pubspec.lock`: refreshed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @monsieurtanuki
Thank you @M123-dev! |
New file:
nutrition_add_nutrient_button.dart
: Button that opens an "add nutrient" dialog.Impacted files:
nutrition_container.dart
: heavy refactoring usingNutrient
instead ofString
idsnutrition_page_loaded.dart
: now usingNutrient
instead ofString
idsportion_helper.dart
: now using newnutriments.getValue
instead of json map trickproduct_query.dart
: added fieldsNUTRIMENT_DATA_PER
andNUTRITION_DATA
app/pubspec.lock
: wtfsmooth_app/pubspec.lock
: wtfpubspec.yaml
: upgraded toopenfoodfacts: 1.26.2
What
<Nutrient, double?>
map behind, and only when the user clicks on "Save!" will we say if it's for 100g or for serving - depending on the "per serving?" switch. That fixes the referenced issue.Nutrient
class and the related methods inNutriments
.Fixes bug(s)