patzly / grocy-android

ERP beyond your fridge, now on your phone – An awesome companion app for grocy
https://patrickzedler.com/grocy/
GNU General Public License v3.0
830 stars 80 forks source link

Strange quantity when scanning items to fill stock #799

Open ybbus opened 7 months ago

ybbus commented 7 months ago

Hi.

When I go shopping and scan the items, on some items, the app automatically adds this item several times instead of just once.

If I do not look exactly on the information after scanning, I sometimes miss, that to many items are added. So I would expect to always add one item when I scan one item.

Normally if I want to add more items (that also have the same expiry date) I cancel the automatic commit message and increase the item count and then press save.

Normally, even if I bought several items of the same type (e.g. soup) I scan and add them once after another since they have different expiry dates.

So is there some logic behind these behavior, that some items that I scan have an automatic quantity that is more than 1? Can I somehow change this?

And maybe a related issue: The same is true if I consume an item. On some items it happens, that if I scan one item (e.g. take a soup) that automatically 2 or more items are removed from the list. Also here, if I do not watch carefully, my inventory is already wrong. Maybe this are the items that were also added as multiples before?

For me this behavior is totally confusing and makes the automatic commit useless, since I do have to always anyway check very carefully, that the amount is correct.

patzly commented 7 months ago

This should absolutely not be the case, for me it works like you expect it. Default purchase quantity can be changed in product settings, but if you never touched this it should always be 1. So either this has to be a database issue of your server or something other is broken. Maybe you can try this on your web interface again so we know this is an app-side issue? Because the app only sends API requests to the server and never actually calculates the new amounts etc., this is all done by the server application and therefore would be an issue for the grocy repo and not our app.

ybbus commented 7 months ago

Yes, should also be a server problem, I opened an issue on their side.

ybbus commented 7 months ago

Hi, it seems that it is not a server problem, and that the server is behaving as expected. It just returns the number of items for that specific stock, and since there are three items with the same barcode, it returns three.

Maybe this is still a feature request for the Android app, since this is more like a consumer UI and should be a bit more end-user friendly (compared to a more table-based professional web interface).

Since you also offer an automatic commit of scans (after some seconds the consumption or addition of items is committed automatically), I would expect by default to just remove or add one single item (even though this does not come from the backend).

Otherwise, the automatic commit does not make sense, since most of the time you have multiple items with the same barcode in stock. But also, most of the time you only want to consume one single item, not all of them.

This also does not seem to work with the "default amount to consume" since this only works with items of different barcodes.

The same is true for adding items to stock. It just returns the number of items in stock, and the app would automatically commit when I have this correctly in mind (I have to try that again).

This means: As an end user, I do not want to add three new items to the stock just because there are already three items existing. Next time, it would ask me to add six new items since there are already six in it. I think the Android app cannot in this case just forward that amount that comes from the backend 1:1.

davewhb commented 6 months ago

I have been having a similar issue lately although mine has been around consuming products since I normally add them from the shopping list rather than scanning them and adding them.

I found that it was being caused by the "amount" associated to the barcode in grocy. image

I am still a bit new to this so i could be wrong but this does not seem to be a value that is directly related to stock.

If i set this value to 1 then it will add 1 when scanned for purchase or consume 1 when scanned out. If set to 2 then it will add 2 when scanned for purchase or consume 2 when scanned out. Changing the value does not change my stock quantity.

I also confirmed the same behavior using the grocy interface on my mobile device to bypass the grocy android app.

My mystery is "how" did that number get changed because I have no recollection of ever editing it.

I hope this helps.