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: weighter->weigher, numbers vs strings, weights with units #8056

Merged
merged 9 commits into from
Feb 1, 2023

Conversation

stephanegigandet
Copy link
Contributor

This PR fixes 3 issues related to packaging weights:

  • the weighers facet was mispelled (weighters with an extra t)
  • some numbers were converted to strings when computing the weighers facet
  • weights entered as strings with units were not recorded on the website and API

Some functions were moved out from Food.pm to a new Units.pm in order to use them in Packaging.pm

@stephanegigandet stephanegigandet requested a review from a team as a code owner January 31, 2023 14:45
@github-actions github-actions bot added API v3 API WRITE WRITE API to allow sending product info and image Data import Display Food.pm MongoDB We have 2 mongodb collections: one for current products, and one for obsolete products multilingual products 📦 Packaging https://wiki.openfoodfacts.org/Category:Recycling 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Products Tags 🧪 tests Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org labels Jan 31, 2023
@github-actions github-actions bot added the 📚 Documentation Documentation issues improve the project for everyone. label Jan 31, 2023
@sonarcloud
Copy link

sonarcloud bot commented Jan 31, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@codecov-commenter
Copy link

Codecov Report

Merging #8056 (fbf7d62) into main (9c34e6e) will increase coverage by 0.01%.
The diff coverage is 81.34%.

❗ Current head fbf7d62 differs from pull request most recent head c0f2cb1. Consider uploading reports for the commit c0f2cb1 to get more accurate results

@@            Coverage Diff             @@
##             main    #8056      +/-   ##
==========================================
+ Coverage   44.68%   44.70%   +0.01%     
==========================================
  Files          99      100       +1     
  Lines       20196    20212      +16     
  Branches     4636     4636              
==========================================
+ Hits         9025     9035      +10     
- Misses      10097    10103       +6     
  Partials     1074     1074              
Impacted Files Coverage Δ
lib/ProductOpener/Tags.pm 36.85% <ø> (ø)
tests/unit/food.t 81.48% <ø> (-7.26%) ⬇️
lib/ProductOpener/Products.pm 36.73% <12.50%> (-0.09%) ⬇️
lib/ProductOpener/Packaging.pm 72.65% <25.00%> (-0.80%) ⬇️
lib/ProductOpener/Units.pm 68.29% <68.29%> (ø)
lib/ProductOpener/Display.pm 4.61% <100.00%> (+0.02%) ⬆️
lib/ProductOpener/Food.pm 61.30% <100.00%> (-0.35%) ⬇️
lib/ProductOpener/ImportConvert.pm 61.49% <100.00%> (+0.05%) ⬆️
tests/unit/units.t 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Comment on lines +2122 to +2125
# We make a copy of numeric values so that Perl does not turn the value to a string when we concatenate it in the signature
my $number_of_units = $packagings_ref->{number_of_units};
my $weight_measured = $packagings_ref->{weight_measured};

Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

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

Cool !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪶 Apache We use Apache as a server to run Open Food Facts API v3 API WRITE WRITE API to allow sending product info and image Data import Display 📚 Documentation Documentation issues improve the project for everyone. Food.pm MongoDB We have 2 mongodb collections: one for current products, and one for obsolete products 📦 Packaging https://wiki.openfoodfacts.org/Category:Recycling 🏭 Producers Platform https://wiki.openfoodfacts.org/Platform_for_producers Products serving size Tags 🧪 tests Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org 🧪 unit tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants