From 16e6efe6c24eefc2a40de106bd747a52d2017d00 Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sat, 2 Dec 2023 02:45:37 +0100 Subject: [PATCH] Fix unpaid market orders shown --- db/market.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/db/market.go b/db/market.go index 5490888..f645a8f 100644 --- a/db/market.go +++ b/db/market.go @@ -152,7 +152,8 @@ func (db *DB) FetchMarketOrders(marketId int64, orders *[]Order) error { "CASE WHEN o.order_id IS NOT NULL THEN 'EXECUTED' ELSE 'PENDING' END AS status, o.order_id " + "FROM orders o " + "JOIN shares s ON o.share_id = s.id " + - "WHERE s.market_id = $1 AND ( (o.side = 'BUY') OR o.side = 'SELL' ) " + + "JOIN invoices i ON o.invoice_id = i.id " + + "WHERE s.market_id = $1 AND ( (o.side = 'BUY' AND i.confirmed_at IS NOT NULL) OR o.side = 'SELL' ) " + "ORDER BY o.created_at DESC" rows, err := db.Query(query, marketId) if err != nil {