Fix unpaid market orders shown

This commit is contained in:
ekzyis 2023-12-02 02:45:37 +01:00
parent 7fc63f44cd
commit 16e6efe6c2

View File

@ -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 {