Skip to content
Snippets Groups Projects
Commit d0be5a30 authored by meskio's avatar meskio :tent:
Browse files

Get the right information from DB to display orders

parent 7dd14a38
No related branches found
No related tags found
No related merge requests found
......@@ -78,7 +78,7 @@ func (d *DB) GetOrder(memberNum int, id int) (order Order, transaction Transacti
}
err = d.db.Where("member = ? AND type = 'order' AND order_id = ?", memberNum, id).
Preload("OrderPurchase.OrderProduct").
Preload("OrderPurchase.OrderProduct.Product").
Find(&transaction).Error
return
}
......@@ -391,7 +391,7 @@ func (d *DB) DeactivateOrders() []Order {
t := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, time.Local)
err := d.db.Where("active = ? AND deadline < ?", true, t).
Preload("Member").
Preload("Transactions.OrderPurchase.OrderProduct").
Preload("Transactions.OrderPurchase.OrderProduct.Product").
Preload("Transactions.Member").
Find(&orders).Error
if err != nil {
......
......@@ -25,7 +25,7 @@ Se han pedido:{{range $name, $amount := .Products}}
Las siguientes personas han pedido:
{{range $name, $purchases := .Purchases}}
{{$name}}:{{range $purchases}}
* {{.Product.Name}}: {{.Amount}}{{end}}
* {{.OrderProduct.Product.Name}}: {{.Amount}}{{end}}
{{end}}
Salud y garbancicos.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment