Skip to content

Commit

Permalink
🔨 restrict datapages to only charts with vars that have any descripti…
Browse files Browse the repository at this point in the history
…on* set
  • Loading branch information
danyx23 committed Nov 16, 2023
1 parent 21c3d9a commit 8b0e027
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions baker/GrapherBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import * as db from "../db/db.js"
import { glob } from "glob"
import { isPathRedirectedToExplorer } from "../explorerAdminServer/ExplorerRedirects.js"
import { bySlug, getPostBySlug, parsePostAuthors } from "../db/model/Post.js"
import { GrapherInterface } from "@ourworldindata/grapher"
import { ChartTypeName, GrapherInterface } from "@ourworldindata/grapher"
import workerpool from "workerpool"
import ProgressBar from "progress"
import {
Expand All @@ -62,6 +62,7 @@ import { logErrorAndMaybeSendToBugsnag } from "../serverUtils/errorLog.js"
import { parseFaqs } from "../db/model/Gdoc/rawToEnriched.js"
import { Gdoc } from "../db/model/Gdoc/Gdoc.js"
import { getShortPageCitation } from "../site/gdocs/utils.js"
import { isEmpty } from "lodash"

/**
*
Expand All @@ -83,13 +84,21 @@ export const renderDataPageOrGrapherPage = async (
const yVariableIds = grapher
.dimensions!.filter((d) => d.property === DimensionProperty.y)
.map((d) => d.variableId)
if (yVariableIds.length === 1) {
if (
yVariableIds.length === 1 &&
grapher.type !== ChartTypeName.ScatterPlot
) {
const variableId = yVariableIds[0]
const variableMetadata = await getVariableMetadata(variableId)

if (
variableMetadata.schemaVersion !== undefined &&
variableMetadata.schemaVersion >= 2
variableMetadata.schemaVersion >= 2 &&
(!isEmpty(variableMetadata.descriptionShort) ||
!isEmpty(variableMetadata.descriptionProcessing) ||
!isEmpty(variableMetadata.descriptionKey) ||
!isEmpty(variableMetadata.descriptionFromProducer) ||
!isEmpty(variableMetadata.presentation?.titlePublic))
) {
return await renderDataPageV2({
variableId,
Expand Down

0 comments on commit 8b0e027

Please sign in to comment.