Stats: video details follow-ups — drop the media request, fix hours-watched formatting - #112528
Merged
Merged
Conversation
'watch_time > 1' rendered both 0 and exactly 1 as '< 1.0' — zero hours reading as 'less than one' is misleading. Matches the fix already applied to the video details metric cards in #112499. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Jetpack Cloud Live (direct link)
Automattic for Agencies Live (direct link)
Dashboard Live (dotcom) (direct link)
|
It only remained as a title/date fallback after the retention card was removed, but the statsVideo response's attachment post is the primary source for both and is available in every environment — while the media request is a guaranteed 404 in Odyssey and redundant in Calypso. Part of STATS-299. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dognose24
marked this pull request as ready for review
July 10, 2026 18:29
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is a follow-up to #112499 that removes a redundant (and Odyssey-incompatible) media-item fetch from the Stats video details page, and corrects “Hours Watched” formatting in the VideoPress stats grid so 0 and 1 hours display as numeric values rather than < 1.0.
Changes:
- Remove
QueryMedia/getMediaItemusage fromstats-video-detailand rely solely on thestatsVideoattachment post for title/date. - Adjust “Hours Watched” display logic in
videopress-stats-moduleto render0.0and>= 1.0as numbers, reserving< 1.0for values strictly between 0 and 1.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| client/my-sites/stats/videopress-stats-module/index.jsx | Updates the hours-watched cell formatting logic for the All videos grid. |
| client/my-sites/stats/stats-video-detail/index.tsx | Removes the media-item request/fallback and uses statsVideo post fields for the header card. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
A failed statsVideo request left data null forever, so the header card shimmered indefinitely — and the chart and embeds card had the same gap. Derive loading from hasSiteStatsQueryFailed as well, so a failure resolves to the hidden card / empty states instead. Part of STATS-299 follow-ups. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
dognose24
added this pull request to the merge queue
Jul 10, 2026
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.
Follow-up to #112499.
Proposed Changes
stats/videoresponse's attachment post is the primary source for both in every environment — while the media request is a guaranteed 404 in Odyssey Stats (the stats-app proxy has no media route) and redundant on Calypso.videopress-stats-module), per this #112499 review thread:watch_time > 1rendered both0and exactly1as< 1.0— zero hours reading as "less than one" is misleading. Values of exactly0and>= 1now render as numbers;< 1.0remains only for values strictly between zero and one, matching the video details metric cards.Why are these changes being made?
Testing Instructions
/stats/day/videodetails/:site?post=<id>) with the network tab open — there should be no/media/<id>request (previously a v1.2 media request fired, and 404ed in Odyssey Stats); the header card title and published date still render./stats/day/videoplays/:site): a video with zero watch time should show0.0(previously< 1.0), exactly 1 hour shows1.0, a fraction of an hour still shows< 1.0, larger values unchanged.API response
Pre-merge Checklist
🤖 Generated with Claude Code