Skip to content

Conversation

@meedoomostafa
Copy link
Contributor

The Problem: On the /swiss homepage, tournaments were displayed in a disjointed chronological order (e.g., a tournament starting in "26 minutes" followed by one starting in "2 hours", then back to "6 minutes"). This happened because SwissFeature.scala merged two lists (team tournaments and cached public tournaments) using concatenation (:::) and distinctBy, but failed to re-sort the final combined list.

The Solution: I updated SwissFeature.get to explicitly sort the combined lists using the existing startsAtOrdering:

Created tournaments: Sorted by startsAt (ascending) so the soonest tournaments appear first.

Started tournaments: Sorted by startsAt (descending/reverse) so the most recently started ones appear first.

Changes:

Modified modules/swiss/src/main/SwissFeature.scala to apply .sorted after merging the lists.

Verification:

Verified that the upcoming tournaments list on /swiss is now strictly chronological.

Fixed #18817

@meedoomostafa meedoomostafa force-pushed the sorting-swiss-tournamnet-list branch from 3d6444c to 146928a Compare December 6, 2025 20:55
@ornicar
Copy link
Collaborator

ornicar commented Dec 8, 2025

The swiss tournaments are sorted by number of players

image

https://github.com/lichess-org/lila/blob/sorting-swiss-tournamnet-list/modules/swiss/src/main/SwissFeature.scala#L82-L82

distinctBy preserves the order of the list.

@meedoomostafa
Copy link
Contributor Author

The swiss tournaments are sorted by number of players
image

https://github.com/lichess-org/lila/blob/sorting-swiss-tournamnet-list/modules/swiss/src/main/SwissFeature.scala#L82-L82

distinctBy preserves the order of the list.

You're right about distinctBy.

However, I think it's confusing for players that they cannot choose their preferred sort type.
For now, I suggest sorting upcoming tournaments differently while keeping running tournaments sorted by the number of players.

My basic suggestion:
Add a UI filter that allows players to choose the sorting method they prefer.

@ornicar ornicar closed this in f8ea270 Dec 9, 2025
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.

Swiss tournament list (upcoming) - sort order broken

2 participants