Skip to content

Commit

Permalink
🤖 Fix FAQ images on data page
Browse files Browse the repository at this point in the history
Related to #3862

(Lars experimenting with Copilot Workspace)

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/owid/owid-grapher/issues/3862?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
larsyencken committed Nov 8, 2024
1 parent 3db6918 commit 6afe4ee
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions baker/DatapageHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
getNextUpdateFromVariable,
omitUndefinedValues,
partition,
traverseEnrichedBlocks,

Check failure on line 13 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?

Check failure on line 13 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?

Check failure on line 13 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?

Check failure on line 13 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?
extractFilenamesFromBlock,

Check failure on line 14 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.

Check failure on line 14 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.

Check failure on line 14 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.

Check failure on line 14 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.
} from "@ourworldindata/utils"
import {
getGdocBaseObjectById,
Expand Down Expand Up @@ -221,3 +223,7 @@ export const getPrimaryTopic = async (
}
return undefined
}

export const extractFilenamesFromFaqEntries = (faqEntries: FaqEntryData) => {

Check failure on line 227 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

Cannot find name 'FaqEntryData'.

Check failure on line 227 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

Cannot find name 'FaqEntryData'.

Check failure on line 227 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / bundlewatch

Cannot find name 'FaqEntryData'.

Check failure on line 227 in baker/DatapageHelpers.ts

View workflow job for this annotation

GitHub Actions / testdbcheck

Cannot find name 'FaqEntryData'.
return traverseEnrichedBlocks(faqEntries.faqs, extractFilenamesFromBlock)
}
6 changes: 5 additions & 1 deletion baker/GrapherBaker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
keyBy,
compact,
mergeGrapherConfigs,
traverseEnrichedBlocks,

Check failure on line 14 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / bundlewatch

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?

Check failure on line 14 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / testdbcheck

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?

Check failure on line 14 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / bundlewatch

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?

Check failure on line 14 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / testdbcheck

'"@ourworldindata/utils"' has no exported member named 'traverseEnrichedBlocks'. Did you mean 'traverseEnrichedBlock'?
extractFilenamesFromBlock,

Check failure on line 15 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.

Check failure on line 15 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.

Check failure on line 15 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / bundlewatch

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.

Check failure on line 15 in baker/GrapherBaker.tsx

View workflow job for this annotation

GitHub Actions / testdbcheck

Module '"@ourworldindata/utils"' has no exported member 'extractFilenamesFromBlock'.
} from "@ourworldindata/utils"
import fs from "fs-extra"
import * as lodash from "lodash"
Expand Down Expand Up @@ -210,9 +212,11 @@ export async function renderDataPageV2(
.map((r) => r.imageUrl)
.filter((f): f is string => !!f)

const faqFilenames = traverseEnrichedBlocks(faqEntries.faqs, extractFilenamesFromBlock)

const imageMetadata = lodash.pick(
imageMetadataDictionary,
uniq(relatedResearchFilenames)
uniq([...relatedResearchFilenames, ...faqFilenames])
)

const tagToSlugMap = await getTagToSlugMap(knex)
Expand Down

0 comments on commit 6afe4ee

Please sign in to comment.