diff --git a/README.md b/README.md index f6218eb..e36756e 100644 --- a/README.md +++ b/README.md @@ -69,5 +69,5 @@ Once the page is loaded, you can connect your MetaMask wallet and proceed to reg ## Some Demo Screenshots ![](img/Screenshot_20230612_225920.png) -![](img/Screenshot_20230612_230551.png) +![](img/Screenshot_20230612_234213.png) ![](img/Screenshot_20230612_230948.png) \ No newline at end of file diff --git a/backend/main.py b/backend/main.py index 159958d..7a412ad 100644 --- a/backend/main.py +++ b/backend/main.py @@ -43,12 +43,18 @@ def process_data(): filter_str = ', '.join(filter) query = "SELECT id, price FROM products WHERE id IN ({})".format(filter_str) cursor.execute(query, params) - prices = cursor.fetchall() + result = cursor.fetchall() + + prices = {} + for id, price in result: + prices[id] = price amount = 0 for index, product in enumerate(data['products']): + id = product['product_id'] count = int(product['count']) - amount += count * int(prices[index][1]) + print(count * int(prices[id])) + amount += (count * int(prices[id])) cursor.execute('INSERT INTO "orders"("id","shop_id","client_addr","amount") VALUES (NULL,?,NULL,?);', (shop_id, amount)) order_id = cursor.lastrowid diff --git a/img/Screenshot_20230612_230551.png b/img/Screenshot_20230612_230551.png deleted file mode 100644 index 2e3d50c..0000000 Binary files a/img/Screenshot_20230612_230551.png and /dev/null differ diff --git a/img/Screenshot_20230612_234213.png b/img/Screenshot_20230612_234213.png new file mode 100644 index 0000000..21f7695 Binary files /dev/null and b/img/Screenshot_20230612_234213.png differ