Skip to content

Commit

Permalink
🐛 fix chart pageviews sql query bug to only match pageviews for publi…
Browse files Browse the repository at this point in the history
…shed charts
  • Loading branch information
danyx23 committed Dec 13, 2024
1 parent ef7505a commit 5ce148a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion adminSiteServer/apiRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ getRouteWithROTransaction(apiRouter, "/charts.json", async (req, res, trx) => {
SELECT ${oldChartFieldList} FROM charts
JOIN chart_configs ON chart_configs.id = charts.configId
JOIN users lastEditedByUser ON lastEditedByUser.id = charts.lastEditedByUserId
LEFT JOIN analytics_pageviews on analytics_pageviews.url = CONCAT("https://ourworldindata.org/grapher/", chart_configs.slug)
LEFT JOIN analytics_pageviews on (analytics_pageviews.url = CONCAT("https://ourworldindata.org/grapher/", chart_configs.slug) AND chart_configs.full ->> '$.isPublished' = "true" )
LEFT JOIN users publishedByUser ON publishedByUser.id = charts.publishedByUserId
ORDER BY charts.lastEditedAt DESC LIMIT ?
`,
Expand Down

0 comments on commit 5ce148a

Please sign in to comment.