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

fix: 5570 - no nutriscore/ecoscore for non-food products #5629

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,13 @@ class SmoothProductCardFound extends StatelessWidget {
padding:
EdgeInsetsDirectional.only(start: VERY_SMALL_SPACE),
),
Padding(
padding: const EdgeInsets.all(VERY_SMALL_SPACE),
child: Column(
children: scores,
if (scores.isNotEmpty)
Padding(
padding: const EdgeInsets.all(VERY_SMALL_SPACE),
child: Column(
children: scores,
),
),
),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class ProductIncompleteCard extends StatelessWidget {
final bool isLoggedInMandatory;

static bool isProductIncomplete(final Product product) {
if (product.productType != null &&
Copy link
Member

Choose a reason for hiding this comment

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

the name doesn't completely reflect what's actually going on

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the name doesn't completely reflect what's actually going on

You're right. The thing is that we display the "hey your product is incomplete" message only when the product is incomplete, for food products, therefore isProductIncomplete made sense.
I've just added an "if not food, consider as complete" test.
I can rename the method to isIncompleteFoodProduct: would that be OK with you?

product.productType != ProductType.food) {
return false;
}
bool checkScores = true;
if (_isNutriscoreNotApplicable(product)) {
AnalyticsHelper.trackEvent(
Expand Down
Loading