-
-
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
feature/#191 - added and computed possible product improvements #217
feature/#191 - added and computed possible product improvements #217
Conversation
…vements Impacted files: * `api_getProduct_test.dart`: added checks for `getProductImprovements` * `Product.dart`: create `enum ProductImprovement` and `Product.getProductImprovements()`
Is the scope the implementation of the Open Food Facts states ? |
lib/model/Product.dart
Outdated
/// when displaying a [Product]. | ||
Set<ProductImprovement> getProductImprovements() { | ||
final Set<ProductImprovement> result = {}; | ||
if (statesTags != null) { |
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.
Minor but I'd avoid nested if structures like this, if possible. You could change it by adding something like
if (statestags == null) {
return result;
}
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.
Thank you @peterwvj for your comment.
I agree with you, I'm a big fan myself of return
, break
or continue
statements instead of else
s (nested or not).
The thing is that I also had in mind #193, that will impact the very same method.
When I implement #193 (next week), I'll take your remark into account if still relevant.
@teolemon If the question is for me, could you please elaborate on it? |
So far, the PR is implementing some of the available states (https://world.openfoodfacts.org/states, https://github.com/openfoodfacts/openfoodfacts-server/blob/main/taxonomies/states.txt) |
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
Impacted files:
api_getProduct_test.dart
: added checks forgetProductImprovements
Product.dart
: createenum ProductImprovement
andProduct.getProductImprovements()