Automattic / Automattic/jetpack

Top Posts block: posts with same stat count ordered randomly

Open
#36,122 2 comments 0 reactions 0 assignees View on GitHub
[Block] Top Posts Customer Report [LEGACY] Enhancement
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

> If two or more posts have the exact same stats (e.g. a bunch of posts all have 0 visits), then the block will order them randomly between themselves on every load, i.e. each and every time that list will look different. This looks a bit weird, and might subtly suggest to the user (even though it’s not technically true) that the Stats block/plugin isn’t working as expected, because if the number of visits doesn’t change between loads, why would the order of posts that get shown there be different on every load? I think it would be better if the order in that list remained constant on every load.

> Perhaps order by number of visits first, then by some other constant field, e.g. publication date

Via Jetpack 13.2 internal testing: p8oabR-1t3-p2#comment-7901

Contributor guide

Open the contributing guide

Research direction

The issue does not name a file or test; start by locating the Top Posts block implementation and the code that orders posts by their stats. Verify the current behavior with posts sharing an identical stat count, then confirm that a deterministic secondary ordering keeps their order stable between loads.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
analytics, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.