openfoodfacts / smooth-app

🤳🥫 The new Open Food Facts mobile application for Android and iOS, crafted with Flutter and Dart
https://world.openfoodfacts.org/open-food-facts-mobile-app?utm_source=off&utf_medium=web&utm_campaign=github-repo
Apache License 2.0
787 stars 271 forks source link

Weird behavior with the cache #4254

Open teolemon opened 1 year ago

teolemon commented 1 year ago

What

monsieurtanuki commented 1 year ago

@teolemon Can you elaborate a little? I have no idea what you're complaining about.

teolemon commented 1 year ago

Missing data to compute Nutri-Score + Prompt to complete product, while everything is actually already there, and the fasttrack promo disappears if you refresh the product. The video needs to be paused, but it should be quite explicit

monsieurtanuki commented 1 year ago
  1. you scanned a product
  2. on the product page you see
    1. the "3 questions" button
    2. the "missing data for nutriscore" button
    3. a computed ecoscore
  3. you click on the "missing data for nutriscore" button
  4. you see a "missing nutrition facts" button, and you click on it
  5. ... but the nutrition facts are already populated, so you didn't expect a "missing nutrition facts" button in the first place, right?
  6. you click back to the product page, and click on the "3 questions" button
  7. you see that nutriscore is not computed, though the category and the nutrition facts are not empty
  8. for some reason, then you go to the edit ingredient OCR page

What I can say is:

  1. the "missing data for nutriscore" button is from KP, which is potentially not refreshed at the same time as the rest of the product. More specifically, as we use background tasks, we do set for instance the category immediately locally, while the edits are uploaded to the server. So we have locally a visible category, that is not yet on the server, so we don't have the nutriscore yet. When the category is indeed uploaded, we download the product (including fresh nutriscore and KP) and refresh it locally. I think that's what is bothering you here. It's not a problem of cache, it's a matter of Smoothie depending on the server for scores and KP.
  2. the nutriscore needs specific nutrient values to be populated (e.g. fat), so you can have populated nutrition facts but not computed nutriscore
  3. the "3 questions" button was correct, as the ingredients were not populated at all. As already mentioned, I would be less confusing to have tailored labels (e.g. "Answer 1 question about the ingredients and compute the eco-score")
  4. "the fasttrack promo disappears if you refresh the product." it's not in the video, right?
monsieurtanuki commented 1 year ago

Possible solutions: