From f81e18c57d1ef1057f46e214d3db8168fa3396c4 Mon Sep 17 00:00:00 2001 From: Katie Sexton Date: Fri, 7 Oct 2022 17:26:05 -0600 Subject: [PATCH 1/2] fix: carousel feed allows configured dam --- blocks/carousel/carousel.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/blocks/carousel/carousel.js b/blocks/carousel/carousel.js index 177ab00a..e42afd2d 100644 --- a/blocks/carousel/carousel.js +++ b/blocks/carousel/carousel.js @@ -47,10 +47,11 @@ async function insertCourseFeedSlides(block) { const code = json.tourCode; const perm = json.permNum; const { courseId } = json.courses[0]; + const tournament = config['dam-code'] ? config['dam-code'] : `${code}${perm}`; // eslint-disable-next-line no-restricted-syntax for (const hole of json.courses[0].holes) { - const damSrc = `${damPrefix}/${code}${perm}/${courseId}/holes/hole${hole.holeNum}.jpg`; - const holeJpg = `${cloudinaryPrefix},w_1290/v1/pgatour/courses/${code}${perm}/${courseId}/holes/hole${hole.holeNum}.jpg`; + const damSrc = `${damPrefix}/${tournament}/${courseId}/holes/hole${hole.holeNum}.jpg`; + const holeJpg = `${cloudinaryPrefix},w_1290/v1/pgatour/courses/${tournament}/${courseId}/holes/hole${hole.holeNum}.jpg`; const holePng = `${cloudinaryPrefix},w_150/holes_${config.year || new Date().getFullYear()}_${code}_${perm}_${courseId}_overhead_full_${hole.holeNum}.png`; // eslint-disable-next-line no-await-in-loop const metaresp = await fetch(`https://little-forest-58aa.david8603.workers.dev/?url=${encodeURIComponent(`${damSrc}/jcr:content/metadata.json`)}`); From de2cdd3eacb0a60dcf493d946be88b26ddf5bf0e Mon Sep 17 00:00:00 2001 From: Katie Sexton Date: Mon, 10 Oct 2022 17:30:58 -0600 Subject: [PATCH 2/2] fix: data scrub --- blocks/carousel/carousel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blocks/carousel/carousel.js b/blocks/carousel/carousel.js index e42afd2d..3bd7bb22 100644 --- a/blocks/carousel/carousel.js +++ b/blocks/carousel/carousel.js @@ -58,7 +58,7 @@ async function insertCourseFeedSlides(block) { // eslint-disable-next-line no-await-in-loop const meta = await metaresp.json(); const metaDesc = meta['dc:description']; - const metaCreator = meta['dc:creator']; + const metaCreator = typeof meta['dc:creator'] === 'object' ? meta['dc:creator'] : [meta['dc:creator']]; const metaRights = meta['dc:rights']; const metaTitle = meta['dc:title']; const avg = hole.stats.find((stat) => stat.id === '43108').eV2;