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: 4947 - added local "last access" timestamp for products #4969

Merged
merged 3 commits into from
Jan 25, 2024

Conversation

monsieurtanuki
Copy link
Contributor

What

  • As @LuanRoger suggested, I've added a local "last access" timestamp for products.
  • With this timestamp, we'll be able to refresh the most interesting products first, for instance when we switch app languages.

Part of

Files

New file:

  • dao_product_last_access.dart: Table that stores the local last access timestamp for a product.

Impacted files:

  • local_database.dart: new version of the database, because of the new "product last access" table
  • new_product_page.dart: added a call to refresh the product "last access" timestamp
  • offline_data_page.dart: added a call to delete the product "last access" timestamps
  • product_model.dart: added a call to refresh the product "last access" timestamp
  • pubspec.lock: wtf

New file:
* `dao_product_last_access.dart`: Table that stores the local last access timestamp for a product.

Impacted files:
* `local_database.dart`: new version of the database, because of the new "product last access" table
* `new_product_page.dart`: added a call to refresh the product "last access" timestamp
* `offline_data_page.dart`: added a call to delete the product "last access" timestamps
* `product_model.dart`: added a call to refresh the product "last access" timestamp
* `pubspec.lock`: wtf
@monsieurtanuki monsieurtanuki requested a review from a team as a code owner January 10, 2024 10:04
@github-actions github-actions bot added 🥫 Product page Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. labels Jan 10, 2024
@codecov-commenter
Copy link

Codecov Report

Attention: 16 lines in your changes are missing coverage. Please review.

Comparison is base (85784fa) 9.62% compared to head (5a45acd) 9.61%.

Files Patch % Lines
...ooth_app/lib/database/dao_product_last_access.dart 0.00% 9 Missing ⚠️
...smooth_app/lib/pages/product/new_product_page.dart 0.00% 3 Missing ⚠️
...ckages/smooth_app/lib/pages/offline_data_page.dart 0.00% 2 Missing ⚠️
...ckages/smooth_app/lib/database/local_database.dart 0.00% 1 Missing ⚠️
...th_app/lib/pages/product/common/product_model.dart 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           develop   #4969      +/-   ##
==========================================
- Coverage     9.62%   9.61%   -0.01%     
==========================================
  Files          323     324       +1     
  Lines        16267   16282      +15     
==========================================
  Hits          1565    1565              
- Misses       14702   14717      +15     

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

@teolemon
Copy link
Member

@M123-dev @g123k @AshAman999 could you have a look ?

Copy link
Member

@M123-dev M123-dev left a comment

Choose a reason for hiding this comment

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

A small naming thing, besides that good idea 👍🏼

Comment on lines +7 to +12
class DaoProductLastAccess extends AbstractSqlDao {
DaoProductLastAccess(super.localDatabase);

static const String TABLE = 'product_last_access';
static const String COLUMN_BARCODE = 'barcode';
static const String COLUMN_LAST_ACCESS = 'last_access';
Copy link
Member

Choose a reason for hiding this comment

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

The name "LastAccess" could be confusing, we should clarify somewhere that its the last server access, not last local access to the product

@monsieurtanuki monsieurtanuki merged commit 1807968 into openfoodfacts:develop Jan 25, 2024
6 checks passed
@monsieurtanuki
Copy link
Contributor Author

Thank you @M123-dev for your review!

The name "LastAccess" could be confusing, we should clarify somewhere that its the last server access, not last local access to the product

/// Table that stores the local last access timestamp for a product.
class DaoProductLastAccess extends AbstractSqlDao {
// ...
  static const String COLUMN_LAST_ACCESS = 'last_access';

I did specify it's the "local last access timestamp for a product".

Now that the table is created, if someone finds a better naming for the class (DaoProductLatestLocalAccess instead?) or the column (COLUMN_LATEST_LOCAL_ACCESS instead ?), why not, it will have no major impact. As long as we don't change the SQL table and columns names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Product addition The easier it is to add a product and get Nutri-Score, Eco-Score, the happier the users. 🥫 Product page
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants