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

Carousel feed dam fix #23

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions blocks/carousel/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ 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`)}`);
// 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;
Expand Down