heig / GrocyToBring

Copy missing items from grocy to bring
19 stars 3 forks source link

Division by zero in /usr/src/grocytobring/index.php on line 44 #5

Closed jacotec closed 1 year ago

jacotec commented 1 year ago

I'm playing with this great addition, unfortunately I'm always getting the error above when running the docker container.

Might be related to this breaking change in Grocy 4.0.0:

The product property qu_factor_purchase_to_stock was removed

Removing the division by "qu_factor_purchase" from the index.php makes it work.

heig commented 1 year ago

Hi @jacotec , thanks for your feedback. I will correct this and push a new version :)

heig commented 1 year ago

I just commited the corrected version :)

jacotec commented 1 year ago

@heig Oops, overlapped ... I've just created a pull request :-) I've also corrected the missing use of plural quantity names ... maybe you'll merge mine with yours ;-)

jacotec commented 1 year ago

@heig OK ... I've double checked, you did the easy workaround I posted in my issue.

Please feel free to merge my PR. The "easy way" does not consider purchase units.

Example: Item: Water Unit: Bottle Purchase Unit: Box (12 bottles per Box) Minimum stock: 5 bottles

With the easy fix this will result in "2 Box" on the shopping list in Bring when the stock drops to 3 bottles.

With my PR you'll get "1 Box" on the list as the amount to shop is calculated using the shopping quantity conversion and unit name. Also it will use the plural "boxes" if the quantity is larger than 1.

heig commented 1 year ago

@jacotec uh thanks - I just reviewed and merged your PR :) Thank you for that!