diff --git a/application/receipts/__pycache__/receipts_api.cpython-313.pyc b/application/receipts/__pycache__/receipts_api.cpython-313.pyc index 8643a43..e8bc1ce 100644 Binary files a/application/receipts/__pycache__/receipts_api.cpython-313.pyc and b/application/receipts/__pycache__/receipts_api.cpython-313.pyc differ diff --git a/application/receipts/receipts_api.py b/application/receipts/receipts_api.py index 2bf2c03..401e326 100644 --- a/application/receipts/receipts_api.py +++ b/application/receipts/receipts_api.py @@ -6,6 +6,7 @@ import math import postsqldb import mimetypes import os +import pprint # APPLICATION IMPORTS import webpush @@ -125,6 +126,7 @@ def addSKULine(): site_name = session['selected_site'] item = receipts_database.getItemAllByID(site_name, (item_id, )) + #pprint.pprint(item) data = { 'cost': item['item_info']['cost'], 'expires': item['food_info']['expires'] @@ -133,6 +135,7 @@ def addSKULine(): type="sku", receipt_id=receipt_id, barcode=item['barcode'], + item_uuid=item['item_uuid'], name=item['item_name'], qty=item['item_info']['uom_quantity'], uom=item['item_info']['uom']['id'], diff --git a/application/receipts/sql/insertReceiptItemsTuple.sql b/application/receipts/sql/insertReceiptItemsTuple.sql index 6aeb85f..8f06d55 100644 --- a/application/receipts/sql/insertReceiptItemsTuple.sql +++ b/application/receipts/sql/insertReceiptItemsTuple.sql @@ -1,4 +1,4 @@ INSERT INTO %%site_name%%_receipt_items -(type, receipt_id, barcode, name, qty, uom, data, status) -VALUES (%s, %s, %s, %s, %s, %s, %s, %s) +(type, receipt_id, barcode, item_uuid, name, qty, uom, data, status) +VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *; \ No newline at end of file diff --git a/logs/database.log b/logs/database.log index 2989e9d..1c5561c 100644 --- a/logs/database.log +++ b/logs/database.log @@ -49,4 +49,13 @@ sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;') 2025-08-09 11:52:23.005675 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_barcodes_pkey"DETAIL: Key (barcode)=(%6589%) already exists.', payload=('%6589%', '7bdc9602-ca87-4e9f-b9ef-fc5e8f0eceb7', 1.0, 1.0, 'Test Item 22'), - sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;') \ No newline at end of file + sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;') +2025-08-09 14:49:30.457282 --- ERROR --- DatabaseError(message='not all arguments converted during string formatting', + payload=('sku', 36, '%078742015101%', '3405b49b-843a-4bca-a235-686e4a9f2e73', '100% grated parmesan cheese', 1, 1, '{"cost": 0, "expires": false}', 'Unresolved'), + sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;') +2025-08-09 14:51:18.570501 --- ERROR --- DatabaseError(message='not all arguments converted during string formatting', + payload=('sku', 36, '%078742015101%', '3405b49b-843a-4bca-a235-686e4a9f2e73', '100% grated parmesan cheese', 1, 1, '{"cost": 0, "expires": false}', 'Unresolved'), + sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;') +2025-08-09 14:53:40.869005 --- ERROR --- DatabaseError(message='not all arguments converted during string formatting', + payload=('sku', 36, '%078742015101%', '3405b49b-843a-4bca-a235-686e4a9f2e73', '100% grated parmesan cheese', 1, 1, '{"cost": 0, "expires": false}', 'Unresolved'), + sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;') \ No newline at end of file