CMM-2141: Fix subscriber email stats missing for recent posts - #23220
Conversation
The Subscribers > Emails panel requested emails sorted by an invalid/opens field over a limited period, so recently emailed posts fell outside the returned set and never appeared, while the web listed them by date. Align both the classic and new-stats paths with the web: period=alltime and sort_field=post_date. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Generated by 🚫 Danger |
Match the web, which requests 10 email entries, so more recent posts are visible in the Subscribers > Emails card without opening the detail list. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…sort The server already returns emails sorted by post_date desc. Re-sorting by post id client-side could reorder them away from true recency. Keep the server order for POST_DATE; only OPENS needs a client-side sort. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
|
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## trunk #23220 +/- ##
==========================================
+ Coverage 37.91% 37.93% +0.02%
==========================================
Files 2347 2347
Lines 127810 127829 +19
Branches 17781 17781
==========================================
+ Hits 48454 48494 +40
+ Misses 75389 75367 -22
- Partials 3967 3968 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The block (post_date) and view-all (opens) email lists share one cache slot, so one response overwrote the other. Include the sort field in the cache key so each ordering is cached independently. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@adalpari This looks good and I verified email stats match the web, but Claude found a few issues. The first issue is flagged as a "blocker" but I'm not sure about the others. |
Not a real blocker since it's talking about old stats, which is not the target of the PR. Anyway, since it seems that the error was there before, I'm also fixing it. |
The classic "View all" list still sorted by opens under the "Latest emails" header, so recently emailed posts stayed missing there. Sort it by post date like the block and the web, so both classic paths are consistent. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
@nbradbury I also fixed the old stats screen here |
…il-stats-not-displayed-for


Description
Subscriber Stats → Subscribers → Emails did not list recently published/emailed
posts in the app, while the web (Calypso / WP Admin) showed them correctly. The issue was
persistent, survived force-stop / cache-clear / pull-to-refresh, and self-resolved after
~1 week — at which point the post reappeared.
Root cause: the app requested the
stats/emails/summaryendpoint with parameters thatdon't match the web, so a freshly emailed post (few/zero opens) was never in the returned
result set:
sort_field=POST_ID(the enum'stoString(), aninvalid value the server ignores) and no
period, so results came back sorted by theserver default (opens). Fixed to send
period=alltimeand the validsort_field=post_date.android_new_stats) — hardcodedperiod=MONTH,sort_field=opens, so theSubscribers card/detail only showed the current month's top posts by opens. Fixed to
period=ALL_TIMEandsort_field=POST_DATE.Both paths now match the web request (
period=alltime,sort_field=post_date,sort_order=desc), so the newest emailed posts appear first.The new-stats Subscribers Emails card now also requests 10 entries (was 5), matching the
web, so more recent posts are visible without opening the detail list.
Testing instructions
Subscriber email stats show recent posts: