Skip to content

[3.0] Ranks ties in the stats top tens in a defined order - #9722

Merged
jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/stats-tie-order
Oct 4, 2026
Merged

jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/stats-tie-order

Conversation

@albertlast

@albertlast albertlast commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The statistics centre orders each top ten by its count alone:

ORDER BY posts DESC
LIMIT 10

so members, boards or topics with the same count come in whatever order the database returns them. MySQL and PostgreSQL disagree about the order, and PostgreSQL returns a row it has just rewritten after the others, so there two tied members swap places whenever one of them logs in or posts.

Each top-ten query now breaks ties by id, so whoever or whatever came first ranks first: top posters, boards, topics by replies and by views (including the pre-selection used on large forums), topic starters, and time online.

The two likes lists are left alone, because #8187 rewrites those queries.

This is the same kind of problem as #9714, #9715 and #9721, found the same way: the snapshot suite in #9712 recorded the top ten in a different order on each engine.

Tests

tests/Integration/Http/StatsTest.php makes two members with the same, very large post count, rewrites the earlier one's row, and checks the stats page ranks them in the order they joined. Without the fix it fails on both engines; with it, it passes on both. Run locally; tests/Integration/Http is not part of the CI run yet.

Not changed here

The topic starters list keeps entries 0 to 10 (if ($i > 10)), which is eleven, while the others keep ten. That is a separate change.

Issues References (Fixes|Related|Closes)

Related: #9714, #9715, #9721, #9712, #8187

🤖 Generated with Claude Code

The statistics centre ordered each top ten by its count alone, so members,
boards or topics with the same count came in whatever order the database
returned them, which differs between the engines and, on PostgreSQL,
between one request and the next. Each query now breaks ties by id, so what
came first ranks first.

The likes lists are left as they are; SimpleMachines#8187 rewrites those queries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants