diff --git a/db/market.go b/db/market.go index f1b4bed..efe66f9 100644 --- a/db/market.go +++ b/db/market.go @@ -138,7 +138,8 @@ func (db *DB) FetchMarketOrders(marketId int64, orders *[]Order) error { "SELECT o.id, share_id, o.pubkey, o.side, o.quantity, o.price, o.invoice_id, o.created_at, s.description, s.market_id " + "FROM orders o " + "JOIN shares s ON o.share_id = s.id " + - "WHERE s.market_id = $1 " + + "JOIN invoices i ON i.id = o.invoice_id " + + "WHERE s.market_id = $1 AND i.confirmed_at IS NOT NULL " + "ORDER BY o.created_at DESC" rows, err := db.Query(query, marketId) if err != nil {