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
853 stars 282 forks source link

Allow to pick a price proof from your online proof gallery #5326

Closed teolemon closed 1 month ago

teolemon commented 5 months ago

Problem

Code pointers

Part of

monsieurtanuki commented 5 months ago

@teolemon cf. @raphael0202 @raphodn

to avoid overload of proofs on the Open prices server

I cannot picture exactly how much it will prevent the overload of proofs. I mean, for the moment in Smoothie we add only prices at the individual product level, but it's temporary. We'll soon be able to add the prices of a whole receipt in one shot (and with only one proof).

I suggest that in "Prices" they recognize identical proof images and return the "old" proof id if relevant - without storing the new one.

we should allow to pick a price proof from your online proof gallery, very much like we already do for regular images

Nice feature, though.

Possible incoherence in the "prices" data model: there are no date or location for proofs:

teolemon commented 5 months ago
monsieurtanuki commented 5 months ago

I still believe it's a minor issue for very specific rare use cases. And you would need the user to be aware enough of the space needed on the server and to check the proof image repository instead of just taking a new picture.

Would probably be better to systematically ask the user for camera / gallery and also latest local proof / server proofs. First step is to split the "proof image" button in "camera" and "gallery". Then "server proof gallery". And probably "latest local proof".

Btw, surprised it got the "top issue" label...

monsieurtanuki commented 5 months ago

@raphael0202 @raphodn Are there some plans about getting smaller versions of proof images, like max width or height = 400? We don't need big pictures for a gallery.

raphodn commented 5 months ago

We already compress the images (done by the web app), so the images shouldn't be that big in size

monsieurtanuki commented 5 months ago

We already compress the images (done by the web app), so the images shouldn't be that big in size

Thanks for your answer! You mean size in memory, not in width/height, right? (that wouldn't change much in this particular case, though) For the record we don't compress images from Smoothie.

raphael0202 commented 4 months ago

@raphael0202 @raphodn Are there some plans about getting smaller versions of proof images, like max width or height = 400? We don't need big pictures for a gallery.

Not yet, but it's something we can implement. And to answer your latest question, yes we only compress it server-side with webp, we don't resize it.

monsieurtanuki commented 4 months ago

@raphael0202 In OFF there are 100, 200 and 400 versions (max width and max height). I think we only use 400 and full versions in Smoothie. I guess resizing as 400 (on demand only, no need to store on the Prices server?) would be enough for us.

raphael0202 commented 4 months ago

I created an issue on Open Prices for this: https://github.com/openfoodfacts/open-prices/issues/340

teolemon commented 1 month ago
monsieurtanuki commented 1 month ago

@teolemon Not sure what you mean: in Smoothie we don't upload a proof without prices. That mean that even if you selected a proof and typed in the prices for 48 products, if you encountered the "losing all work already done" Smoothie bug, no proof was uploaded at all.

teolemon commented 1 month ago

In some cases, you can add 1 receipt with only 10 out of 48 prices. And this receipt is available for completion server side (the web app already does that)

teolemon commented 1 month ago

https://prices.openfoodfacts.org/app/dashboard/proofs Screenshot_20240928-161212.png

monsieurtanuki commented 1 month ago

@teolemon Indeed, as long as you actually created prices (with a proof), the proof is uploaded. Therefore, still waiting for the 400 version of the proof images in order to display correctly a gallery in Smoothie, and then to let the user select a proof from its previous proofs, as an option added to "from camera" and "from device gallery".

raphodn commented 1 month ago

https://github.com/openfoodfacts/open-prices/issues/340 was merged & deployed ! Proofs now have a new field: image_thumb_path size 400

example: https://prices.openfoodfacts.org/img/0011/nTPdYlTHfw.webp / https://prices.openfoodfacts.org/img/0011/nTPdYlTHfw.400.webp

monsieurtanuki commented 1 month ago

Thank you @raphodn, now this issue is blocked on our implementation in dart - https://github.com/openfoodfacts/openfoodfacts-dart/issues/978

monsieurtanuki commented 1 month ago

Thanks again @raphodn, I've just tested, that's much faster for our proof gallery!

monsieurtanuki commented 1 month ago

@raphodn @raphael0202 @teolemon Testing the "add a price to an existing proof taken from the gallery" feature, I've noticed an unexpected behavior regarding duplicates. I've managed to add twice the same product to the same proof. Not nice. Maybe a bit cleaner if the latest price overrides the other ones, for that barcode and that proof. Image

monsieurtanuki commented 1 month ago

The only thing that is currently missing in this issue is adding the "pick a proof from proof gallery" to "take a picture" and "pick a picture from the local gallery". Working on it.