20th Commit

This commit is contained in:
Aritra Banik 2024-02-08 03:04:03 +05:30
parent bb7cf556b3
commit 72bee5e930
4 changed files with 1 additions and 32 deletions

View File

@ -88,8 +88,6 @@ import
password: string
db = newDatabase()
products: seq[Products]
form = ctx.urlForm
echo form
try:
email = ctx.cookies["email"]
@ -108,17 +106,10 @@ import
cart = db.getUserCart(userId)
cook = ctx.cookies
# echo cart
# echo cook
# db.updateCart(cook)
for d, e in cook:
if d.contains("_quantity") == true:
var h = d.split("_")
echo h
for i, j in cart:
# echo i
# echo j
if j.productId == parseInt(h[0]):
db.updateCart(e, j.id)

View File

@ -52,20 +52,4 @@ proc removeFromCart*(db: DbConn, cart: Cart) =
db.exec(sql"DELETE FROM cart WHERE user_id=? AND product_id=?", cart.userId, cart.productId)
proc updateCart*(db: DbConn, quantity: string, id: int) =
# echo id
# echo quantity
# echo userId
# echo db.getAllRows(sql"SELECT * FROM cart WHERE user_id=? AND product_id=?;", userId, parseInt(productId))
db.exec(sql"UPDATE cart SET quantity=? WHERE id=?", quantity, id)
# proc updateCart*(db: DbConn, cookies: StringTableRef) =
# echo cookies
# for d, e in cookies:
# if d.contains("_quantity") == true:
# var h = d.split("_")
# echo h
# db.exec(sql"UPDATE cart SET quantity=? WHERE id=?", e, h[0])
# echo parseInt(h[0])
# echo parseInt(e)

BIN
src/dd

Binary file not shown.

View File

@ -1,6 +0,0 @@
import strformat
var i = @['o', 'p', 'r']
echo i
for q, w in i:
echo fmt"q: {q}, w: {w}"