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: make facets URLS /nova-group/unknown work #10498

Merged
merged 5 commits into from
Jul 2, 2024

Conversation

4nt0ineB
Copy link
Member

What

Few tags like NOVA, Eco-Score and Nutri-Score can have an "unknown" value. Instead of looking for the presence or absence of the tag, we look for the value to be "unknown" (or not-applicable).

Screenshot

Related issue(s) and discussion

@4nt0ineB 4nt0ineB requested a review from a team as a code owner June 26, 2024 10:10
@4nt0ineB 4nt0ineB added 🚦Nutri-Score https://world.openfoodfacts.org/nutriscore Nova - Ultra-processed foods NOVA is an indicator for food ultra-processing https://world.openfoodfacts.org/nova 🌱 Green-Score https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products labels Jun 26, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jun 26, 2024

Codecov Report

Attention: Patch coverage is 25.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 49.33%. Comparing base (dc04d18) to head (1c21274).
Report is 452 commits behind head on main.

Files Patch % Lines
lib/ProductOpener/Display.pm 25.00% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10498      +/-   ##
==========================================
- Coverage   49.54%   49.33%   -0.22%     
==========================================
  Files          67       76       +9     
  Lines       20650    21706    +1056     
  Branches     4980     5209     +229     
==========================================
+ Hits        10231    10708     +477     
- Misses       9131     9683     +552     
- Partials     1288     1315      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -4819,6 +4819,8 @@ sub add_params_to_query ($request_ref, $query_ref) {
if $log->is_debug();

# if the value is "unknown", we need to add a condition on the field being empty

my @tagtype_allowing_unknown_as_value = qw(nutrition_grades nova_groups ecoscore);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add pnns_groups_1, pnns_groups_2 and food_groups?

@@ -4831,7 +4833,7 @@ sub add_params_to_query ($request_ref, $query_ref) {
)
)
and ($tagtype !~ /^pnns_groups_/)
Copy link
Contributor

Choose a reason for hiding this comment

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

pnns_groups_1 / 2 can be included in @tagtype_allowing_unknown_as_value

Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

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

Thank you!

@stephanegigandet stephanegigandet merged commit be8ca7b into openfoodfacts:main Jul 2, 2024
11 checks passed
@4nt0ineB 4nt0ineB deleted the tag-unkown-val branch July 12, 2024 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Display 🌱 Green-Score https://world.openfoodfacts.org/eco-score-the-environmental-impact-of-food-products Nova - Ultra-processed foods NOVA is an indicator for food ultra-processing https://world.openfoodfacts.org/nova 🚦Nutri-Score https://world.openfoodfacts.org/nutriscore 🧪 tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Make facets URLS /nova-group/unknown and /nova_group/not-applicable work
3 participants