Skip to content

Conversation

@FedericoLuque
Copy link
Contributor

@FedericoLuque FedericoLuque commented Dec 8, 2025

What does this PR do?

Fixes #2146

This PR implements dynamic default sorting for the offer book. Offers are now automatically sorted by their premium in a way that is most favorable to the user, depending on the selected offer type.

Specifically:

  • Buy & Swap In offers are sorted by premium in ascending order (lowest premium first).
  • Sell & Swap Out offers are sorted by premium in descending order (highest premium first).

Checklist before merging

  • Install pre-commit and initialize it: pip install pre-commit, then pre-commit install. Pre-commit installs git hooks that automatically check the codebase. If pre-commit fails when you commit your changes, please fix the problems it points out.

Copy link
Member

@KoalaSat KoalaSat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @FedericoLuque thanks for your help, seems like once you apply this filter, the filters bar becomes blocked, that's likely because you are forcing sortModel

@FedericoLuque FedericoLuque force-pushed the feat/2146-sort-by-premium branch from 72a377d to 8210661 Compare December 11, 2025 23:51
@FedericoLuque
Copy link
Contributor Author

Hi @KoalaSat I thought that was the intended behavior. I've modified it so that if a user selects a different order, it's retained.

@FedericoLuque FedericoLuque force-pushed the feat/2146-sort-by-premium branch 2 times, most recently from ced1ba1 to 8210661 Compare December 12, 2025 13:39
@FedericoLuque
Copy link
Contributor Author

Sorry, I closed it by mistake; it didn't ask for confirmation. I'll open it again. I was just browsing.

@FedericoLuque FedericoLuque reopened this Jan 5, 2026
@KoalaSat
Copy link
Member

KoalaSat commented Jan 8, 2026

@FedericoLuque I checked this PR, it doesn´t seem to behave correctly. Here are some comments:

  • On first load, the book appear to be sorted by default with premium asc. The idea is to keep it unsorted as before.
  • It also happens if I switch back to ANY after selecting any other option.
  • If I sort by any other column and then change to BUY/SELL, it doesn't apply this automatic filtering anymore.

Feel free to ask any question or proposal here! and thanks for taking care!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sort by premium when the order type is defined

2 participants