Skip to content

fix: Initialize Nutri-Score max point totals - #14167

Open
subhwastaken wants to merge 5 commits into
openfoodfacts:mainfrom
subhwastaken:fix/nutriscore-max-points
Open

fix: Initialize Nutri-Score max point totals#14167
subhwastaken wants to merge 5 commits into
openfoodfacts:mainfrom
subhwastaken:fix/nutriscore-max-points

Conversation

@subhwastaken

Copy link
Copy Markdown

Fixes #13814

Summary

  • Initialize negative_points_max and positive_points_max before accumulating component maxima.
  • Prevent stale values on reused Nutri-Score data structures from affecting the computed totals.

Checks

  • Added defensive initialization in both supported Nutri-Score calculation paths.

@subhwastaken subhwastaken changed the title Initialize Nutri-Score max point totals fix: Initialize Nutri-Score max point totals Aug 1, 2026
@codecov-commenter

codecov-commenter commented Aug 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 46.97%. Comparing base (bdbac35) to head (1f71d11).
⚠️ Report is 19 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14167      +/-   ##
==========================================
- Coverage   49.93%   46.97%   -2.96%     
==========================================
  Files         102      102              
  Lines       26315    26169     -146     
  Branches     6292     6265      -27     
==========================================
- Hits        13140    12294     -846     
- Misses      11427    12094     +667     
- Partials     1748     1781      +33     
Flag Coverage Δ
integration-test-group-1 13.08% <0.00%> (?)
integration-test-group-3 9.36% <0.00%> (?)
integration-test-group-4 33.28% <100.00%> (?)
integration-test-group-9 26.53% <100.00%> (?)
unit-test-group-1 ?
unit-test-group-2 ?
unit-test-group-3 32.78% <100.00%> (+0.01%) ⬆️
unit-test-group-4 21.80% <0.00%> (-0.01%) ⬇️
unit-test-group-5 28.08% <0.00%> (-0.01%) ⬇️
unit-test-group-6 21.61% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@teolemon teolemon moved this from To discuss and validate to In Progress in 🍊 Open Food Facts Server issues Aug 5, 2026
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress
Status: Todo

Development

Successfully merging this pull request may close these issues.

Nutri-Score positive_points_max and negative_points_max should be initialized before accumulation

3 participants