20th Commit
This commit is contained in:
parent
bb7cf556b3
commit
72bee5e930
@ -88,8 +88,6 @@ import
|
|||||||
password: string
|
password: string
|
||||||
db = newDatabase()
|
db = newDatabase()
|
||||||
products: seq[Products]
|
products: seq[Products]
|
||||||
form = ctx.urlForm
|
|
||||||
echo form
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
email = ctx.cookies["email"]
|
email = ctx.cookies["email"]
|
||||||
@ -108,17 +106,10 @@ import
|
|||||||
cart = db.getUserCart(userId)
|
cart = db.getUserCart(userId)
|
||||||
cook = ctx.cookies
|
cook = ctx.cookies
|
||||||
|
|
||||||
# echo cart
|
|
||||||
# echo cook
|
|
||||||
# db.updateCart(cook)
|
|
||||||
|
|
||||||
for d, e in cook:
|
for d, e in cook:
|
||||||
if d.contains("_quantity") == true:
|
if d.contains("_quantity") == true:
|
||||||
var h = d.split("_")
|
var h = d.split("_")
|
||||||
echo h
|
|
||||||
for i, j in cart:
|
for i, j in cart:
|
||||||
# echo i
|
|
||||||
# echo j
|
|
||||||
if j.productId == parseInt(h[0]):
|
if j.productId == parseInt(h[0]):
|
||||||
db.updateCart(e, j.id)
|
db.updateCart(e, j.id)
|
||||||
|
|
||||||
|
@ -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)
|
db.exec(sql"DELETE FROM cart WHERE user_id=? AND product_id=?", cart.userId, cart.productId)
|
||||||
|
|
||||||
proc updateCart*(db: DbConn, quantity: string, id: int) =
|
proc updateCart*(db: DbConn, quantity: string, id: int) =
|
||||||
# echo id
|
db.exec(sql"UPDATE cart SET quantity=? WHERE id=?", quantity, 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)
|
|
@ -1,6 +0,0 @@
|
|||||||
import strformat
|
|
||||||
|
|
||||||
var i = @['o', 'p', 'r']
|
|
||||||
echo i
|
|
||||||
for q, w in i:
|
|
||||||
echo fmt"q: {q}, w: {w}"
|
|
Loading…
Reference in New Issue
Block a user