|
@@ -92,10 +92,14 @@ class GroceryTransactionEditor(WidgetPlaceholder):
|
|
|
price = data['price']
|
|
|
product = data['product']
|
|
|
organic = 'true' if data['organic'] is True else 'false'
|
|
|
+ tags = ', '.join([
|
|
|
+ f'$quot${v}$quot$' for t,v in data.items() if 'tags' in t
|
|
|
+ ])
|
|
|
+ tags = f", ARRAY[{tags}]" if tags else ''
|
|
|
statement = \
|
|
|
f"CALL insert_transaction('{ts}', $store${store}$store$, " \
|
|
|
f"$descr${description}$descr$, {quantity}, $unit${unit}$unit$, " \
|
|
|
- f"{price}, $produ${product}$produ$, {organic});\n"
|
|
|
+ f"{price}, $produ${product}$produ$, {organic}{tags});\n"
|
|
|
self.log.write(statement)
|
|
|
self.log.flush()
|
|
|
self.cur.execute(statement)
|