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: 5554 - display of cached counts on user page #5573

Merged
merged 2 commits into from
Sep 11, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • Now we cache the count values in the user page.
  • The user can still refresh them individually.
  • There was little added value refreshing very frequently those values, and it had serious side-effects, like preventing the user from running search queries due to max-10-searches-a-minute policy.
  • The values are cached in the preferences.

Screenshot

cached values recomputing 2 values
Screenshot_1725876589 Screenshot_1725877268

Fixes bug(s)

Files

New files:

  • lazy_counter.dart: Lazy Counter, with a cached value stored locally, and a call to the server.
  • lazy_counter_widget.dart: Widget displaying a Lazy Counter: cached value, refresh button, and loading.

Impacted files:

  • user_preferences.dart: added methods about storing a lazy count value
  • user_preferences_account.dart: refactored the display of counts with the new LazyCounter and LazyCounterWidget classes

New files:
* `lazy_counter.dart`: Lazy Counter, with a cached value stored locally, and a call to the server.
* `lazy_counter_widget.dart`: Widget displaying a Lazy Counter: cached value, refresh button, and loading.

Impacted files:
* `user_preferences.dart`: added methods about storing a lazy count value
* `user_preferences_account.dart`: refactored the display of counts with the new `LazyCounter` and `LazyCounterWidget` classes
@codecov-commenter
Copy link

codecov-commenter commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 4.54545% with 63 lines in your changes missing coverage. Please review.

Project coverage is 6.96%. Comparing base (4d9c7fc) to head (402102b).
Report is 304 commits behind head on develop.

Files with missing lines Patch % Lines
...app/lib/pages/preferences/lazy_counter_widget.dart 0.00% 29 Missing ⚠️
...smooth_app/lib/pages/preferences/lazy_counter.dart 10.00% 27 Missing ⚠️
.../lib/data_models/preferences/user_preferences.dart 0.00% 5 Missing ⚠️
...ib/pages/preferences/user_preferences_account.dart 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #5573      +/-   ##
==========================================
- Coverage     9.54%   6.96%   -2.59%     
==========================================
  Files          325     402      +77     
  Lines        16411   21205    +4794     
==========================================
- Hits          1567    1476      -91     
- Misses       14844   19729    +4885     

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

Copy link
Member

@teolemon teolemon left a comment

Choose a reason for hiding this comment

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

good. thanks @monsieurtanuki

@monsieurtanuki monsieurtanuki merged commit 74660f8 into openfoodfacts:develop Sep 11, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @teolemon for your review!

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.

FormatException: FormatException: Unexpected character (at character 1)
3 participants