-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
Add metadata about local Product, for better refresh flexibility #4947
Comments
My first tests are very interesting. |
Possible improvement: a "last access" metadata, cf. @LuanRoger in #4717 (comment). |
Now that #4951 is merged, we have all we need to automatically refresh the products when the app language changes. |
@teolemon I'm sure you'll love that. I don't know if I'll be able to PR today but by the time I switched from the preferences (language: French -> Italian) to the history list, the products were translated!
|
I've just lost all today's code because of merge conflicts with the important matter of #4938's test tube being empty or filled... |
With #4951 and #4969 now merged, we have 2 new metadata:
With those metadata it's very easy to solve the "app language change" problem:
For the nutriscore refresh, the problem is a bit different:
|
This week-end I'll PR the automatic translation system at each app language change. |
Problem
We store products locally with only one metadata: the timestamp of the latest insertion/update in the local database (
last_update
).If we want to do smart database refreshes (e.g. new language), that may not be enough.
"Smart" refreshes mean something more refined than "refresh all the products in one shot".
Proposed solution
The first example that comes to mind is the language. When we download a product, we call the API with a language parameter.
We could store locally the queried language as a metadata, at the same time as we store the product.
With that metadata, we could run queries like "give the local products in history that are not in Italian (new language), most recent first"
Of course, other metadata could be added.
Possibly, additional OFF metadata extracted from the product (like the OFF "last update"). For queries like "give me the local products whose server refresh is more than 2 months old".
Not sure if the country would be as relevant as the language.
Part of
The text was updated successfully, but these errors were encountered: