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

feat: Add NutriScore V2 into cache + semantics #5264

Merged
merged 4 commits into from
May 18, 2024

Conversation

g123k
Copy link
Collaborator

@g123k g123k commented May 17, 2024

Hi everyone,

Now that the Nutri-score V2 is mainly deployed, all SVG are put in cache.

  • Semantics supports both V1 and V2

@codecov-commenter
Copy link

codecov-commenter commented May 17, 2024

Codecov Report

Attention: Patch coverage is 0% with 49 lines in your changes are missing coverage. Please review.

Project coverage is 8.59%. Comparing base (4d9c7fc) to head (1358238).
Report is 121 commits behind head on develop.

Files Patch % Lines
...smooth_app/lib/cards/category_cards/svg_cache.dart 0.00% 29 Missing ⚠️
...kages/smooth_app/lib/resources/app_animations.dart 0.00% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5264      +/-   ##
==========================================
- Coverage     9.54%   8.59%   -0.96%     
==========================================
  Files          325     329       +4     
  Lines        16411   16768     +357     
==========================================
- Hits          1567    1441     -126     
- Misses       14844   15327     +483     

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

Copy link
Contributor

@monsieurtanuki monsieurtanuki left a comment

Choose a reason for hiding this comment

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

Hi @g123k, LGTM!
Feel free to ignore my minor comments.

Comment on lines +95 to +97
if (fileName == 'nutriscore-a.svg') {
return localizations.nutriscore_a;
} else if (fileName == 'nutriscore-b.svg') {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sure a switch syntax would be much easier to read.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Unfortunately, with a return switch statement, it's mandatory to have an else case (didn't know that before trying after your suggestion).
I can "switch" to the old switch (with cases), but in terms of lines, it will be similar

Comment on lines +115 to +116
return localizations.nutriscore_not_applicable_new_formula;
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a matter of personal taste: as you return you don't need an else. Easier to read when there are no useless blocks.

2 => localizations.nutriscore_c,
3 => localizations.nutriscore_d,
4 => localizations.nutriscore_e,
_ => localizations.nutriscore_unknown,
Copy link
Contributor

Choose a reason for hiding this comment

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

"Not applicable" is not there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, for now, the animation lacks this state.
But I will integrate it with V2

@teolemon teolemon merged commit d2d8d0a into openfoodfacts:develop May 18, 2024
6 checks passed
@g123k g123k deleted the semantics_nutriscore branch May 27, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants