q-m / nutriscore-ruby

nutriscore computation for Ruby
MIT License
1 stars 0 forks source link

Looks like saturated_fat value has to be rounded #2

Open zedalaye opened 1 year ago

zedalaye commented 1 year ago

I'm porting your code to Delphi (yes) and as I was using the OpenFoodFact Nutriscore Test suite I discovered that Saturated-Fat value has to be rounded to closest integer.

See this OpenSourceFacts test suite comment : https://github.com/openfoodfacts/openfoodfacts-server/blob/main/tests/unit/nutriscore.t#L59

https://github.com/q-m/nutriscore-ruby/blob/dbffe04acd1c0f45fcf4db76f22dbfed2a6534c1/lib/nutriscore/fr/negative_score.rb#L29

wvengen commented 1 year ago

Thank you for your input, very relevant! I'm curious if we can find the rounding requirement in the source documents, then I'd be happy to correct that.