Skip to content
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

Merged
merged 2 commits into from
Dec 13, 2024

Conversation

danyx23
Copy link
Contributor

@danyx23 danyx23 commented Dec 6, 2024

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

@owidbot
Copy link
Contributor

owidbot commented Dec 6, 2024

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-surface-pageviews-more-in-admin

SVG tester:

Number of differences (default views): 0 ✅
Number of differences (all views): 0 ✅

Edited: 2024-12-06 18:05:23 UTC
Execution time: 1.26 seconds

Comment on lines 59 to 65
return [...filtered].sort((a, b) => {
const aValue = a.pageviewsPerDay || 0
const bValue = b.pageviewsPerDay || 0
return sortConfig.direction === "desc"
? bValue - aValue
: aValue - bValue
})
Copy link
Member

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 :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Comment on lines 217 to 220
? Math.round(
this.pageviews?.views_365d / 36.5
) / 10
: undefined
Copy link
Member

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.

Copy link
Contributor Author

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!

@danyx23 danyx23 merged commit 6439abc into master Dec 13, 2024
15 of 18 checks passed
@danyx23 danyx23 deleted the surface-pageviews-more-in-admin branch December 13, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants