Skip to content

Commit

Permalink
review changes and bug fix
Browse files Browse the repository at this point in the history
Signed-off-by: Philemon Ukane <[email protected]>
  • Loading branch information
ukane-philemon committed Jan 29, 2024
1 parent e3c510e commit ee2d46c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ui/page/dcrdex/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -1794,12 +1794,11 @@ func (pg *DEXMarketPage) refreshOrders() {
pg.orders = nil
for i := range orders {
ord := &clickableOrder{Order: orders[i]}
hasActiveMatch := anyMatchActive(ord.Matches)
if ord.Status == order.OrderStatusExecuted && hasActiveMatch != pg.openOrdersDisplayed /* display active orders on open order view */ {
if ord.Status == order.OrderStatusExecuted && anyMatchActive(ord.Matches) != pg.openOrdersDisplayed /* display active orders on open order view */ {
continue // skip order
}

if pg.openOrdersDisplayed && !ord.Cancelling && !hasActiveMatch {
if pg.openOrdersDisplayed && ord.Status.IsActive() {
ord.cancelBtn = pg.Theme.NewClickable(false)
}

Expand All @@ -1813,14 +1812,13 @@ func (pg *DEXMarketPage) refreshOrders() {
for _, ord := range mkt.InFlightOrders {
pg.orders = append(pg.orders, &clickableOrder{Order: ord.Order})
}

// We've just appended new orders, sort to ensure newest orders are
// displayed first.
sort.SliceStable(orders, func(i, j int) bool {
return pg.orders[i].SubmitTime > orders[j].SubmitTime
})
}
}

// Always sort orders.
sort.SliceStable(pg.orders, func(i, j int) bool {
return pg.orders[i].SubmitTime > orders[j].SubmitTime
})
}

func anyMatchActive(matches []*core.Match) bool {
Expand Down

0 comments on commit ee2d46c

Please sign in to comment.