-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sorting order of offers appropriately by min/max range #4068
Conversation
if (newValue==TableColumn.SortType.DESCENDING) | ||
amountColumn.setComparator(Comparator.comparing(o -> o.getOffer().getAmount(), Comparator.nullsFirst(Comparator.naturalOrder()))); | ||
else | ||
amountColumn.setComparator(Comparator.comparing(o -> o.getOffer().getMinAmount(), Comparator.nullsFirst(Comparator.naturalOrder()))); | ||
}); | ||
volumeColumn.sortTypeProperty().addListener((observable, oldValue, newValue) -> { | ||
if (newValue==TableColumn.SortType.DESCENDING) | ||
volumeColumn.setComparator(Comparator.comparing(o -> o.getOffer().getVolume(), Comparator.nullsFirst(Comparator.naturalOrder()))); | ||
else | ||
volumeColumn.setComparator(Comparator.comparing(o -> o.getOffer().getMinVolume(), Comparator.nullsFirst(Comparator.naturalOrder()))); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we had issues in the past concerning using no brackets for one line conditionals we decided to use always {}
desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NACK - based on my code format comments
ACK for functionality
@jmacxx I just recognized that you haven't signed your commits. |
|
This change fixes an issue with sorting the offer list when the amount is shown as a range. In OfferBookView::activate() we add a listener for the sortTypeProperty on amountColumn and volumeColumn. When the sortType is changed we set the comparator to be the approprate property of the Offer; either getAmount/getMinAmount; getVolume/getMinVolume. Fixes #3818
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK
Testet it on Mainnet.
Awesome work, congrats on your first merged pull request! |
Fixes #3818
This change fixes an issue with sorting the offer list when the amount is shown as a range. The sort was hard coded on the top end of the range which does not make sense when sorting in ascending order.
In OfferBookView::activate() we add a listener for the sortTypeProperty on amountColumn and volumeColumn. When the sortType is changed we set the comparator to be the approprate property of the Offer; either getAmount/getMinAmount; getVolume/getMinVolume.