Gnomeshade icon indicating copy to clipboard operation
Gnomeshade copied to clipboard

Adding purchases from receipt fails when a product with the same name is deleted

Open VMelnalksnis opened this issue 1 year ago • 0 comments

Describe the bug Importing purchases from a receipt fails with internal server error due to duplicate key value violates unique constraint "products_normalized_name" when no matching product is found, but a product with the same name was created before and deleted.

To Reproduce Steps to reproduce the behavior:

  1. Import purchases from a receipt
  2. Replace one of the products with a different one, delete the original
  3. Try to import the same receipt again in a different transaction
  4. See error

Expected behavior The easy solution would be to restore the deleted product. However, I guess the expected behavior would be that product is replaced with the same on as before. That would require adding additional data to products, something like alternative names. That would allow to link names provided by the store in the receipts to be linked to the ones used in the app by the user.

VMelnalksnis avatar Mar 05 '23 09:03 VMelnalksnis