-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ show average daily pageviews in charts list and references tab #4267
Conversation
Quick links (staging server):
Login:
SVG tester:Number of differences (default views): 0 ✅ Edited: 2024-12-06 18:05:23 UTC |
adminSiteClient/ChartIndexPage.tsx
Outdated
return [...filtered].sort((a, b) => { | ||
const aValue = a.pageviewsPerDay || 0 | ||
const bValue = b.pageviewsPerDay || 0 | ||
return sortConfig.direction === "desc" | ||
? bValue - aValue | ||
: aValue - bValue | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably better to use the existing sortNumeric
from utils here.
Just take caution because it sorts in-place, but your current solution is, too :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
? Math.round( | ||
this.pageviews?.views_365d / 36.5 | ||
) / 10 | ||
: undefined |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit arcane - I would prefer you use lodash's round(num, 1)
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah this is much better, thanks!
This was a small request by authors - surfacing pageviews more prominently is useful prioritizing work on charts.
This PR shows the average daily pageviews in the chart index page and allows users to sort by these pageviews.
An index on analytics_pageviews is added so that joins can be more performant