Repository navigation
[3.0] Ranks ties in the stats top tens in a defined order - #9722
Merged
jdarwood007 merged 1 commit intoOct 4, 2026
Merged
Conversation
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>
This was referenced Sep 30, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The statistics centre orders each top ten by its count alone:
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.phpmakes 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/Httpis 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