Skip to content
Draft
Show file tree
Hide file tree
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
8 changes: 3 additions & 5 deletions pages/classes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { useState } from 'react';
import redirectUser from '../../util/redirectUser.js';
import { getAvailableSuperblocks } from '../../util/curriculum/fetchCurriculum';

export async function getServerSideProps(ctx) {
// Dynamic import to prevent Prisma from being bundled for client
Expand Down Expand Up @@ -45,12 +46,9 @@ export async function getServerSideProps(ctx) {
})
);

const superblocksres = await fetch(
'https://www.freecodecamp.org/curriculum-data/v1/available-superblocks.json'
);
const superblocksreq = await superblocksres.json();
const superblocks = await getAvailableSuperblocks();
const blocks = [];
superblocksreq['superblocks'].map((x, i) =>
superblocks.map((x, i) =>
blocks.push({ value: i, label: x.dashedName, displayName: x.title })
);
return {
Expand Down
18 changes: 9 additions & 9 deletions pages/dashboard/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import { createSuperblockDashboardObject } from '../../util/dashboard/createSupe
import { fetchStudentData } from '../../util/student/fetchStudentData';
import redirectUser from '../../util/redirectUser.js';

// NOTE: These functions are deprecated for v9 curriculum (no individual REST API JSON files)
import { getDashedNamesURLs } from '../../util/legacy/getDashedNamesURLs';
import { getNonDashedNamesURLs } from '../../util/legacy/getNonDashedNamesURLs';
import { getSuperBlockJsons } from '../../util/legacy/getSuperBlockJsons';
import {
getAvailableSuperblocks,
getSuperblocksByIndices
} from '../../util/curriculum/fetchCurriculum';

export async function getServerSideProps(context) {
// Dynamic import to prevent Prisma from being bundled for client
Expand Down Expand Up @@ -49,14 +49,14 @@ export async function getServerSideProps(context) {
fccCertifications: true
}
});
let superblockURLS = await getDashedNamesURLs(
certificationNumbers.fccCertifications
const allSuperblocks = await getAvailableSuperblocks();
let nonDashedNames = certificationNumbers.fccCertifications.map(
i => allSuperblocks[i]?.title
);
let nonDashedNames = await getNonDashedNamesURLs(

let superBlockJsons = await getSuperblocksByIndices(
certificationNumbers.fccCertifications
);

let superBlockJsons = await getSuperBlockJsons(superblockURLS);
let dashboardObjs = await createSuperblockDashboardObject(superBlockJsons);

let currStudentData = await fetchStudentData();
Expand Down
8 changes: 2 additions & 6 deletions pages/dashboard/v2/[id].js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { fetchStudentData } from '../../../util/student/fetchStudentData';
import { checkIfStudentHasProgressDataForSuperblocksSelectedByTeacher } from '../../../util/student/checkIfStudentHasProgressDataForSuperblocksSelectedByTeacher';
import redirectUser from '../../../util/redirectUser.js';

// NOTE: These functions are deprecated for v9 curriculum (no individual REST API JSON files)
import { getDashedNamesURLs } from '../../../util/legacy/getDashedNamesURLs';
import { getSuperBlockJsons } from '../../../util/legacy/getSuperBlockJsons';
import { getSuperblocksByIndices } from '../../../util/curriculum/fetchCurriculum';

export async function getServerSideProps(context) {
// Dynamic import to prevent Prisma from being bundled for client
Expand Down Expand Up @@ -57,11 +55,9 @@ export async function getServerSideProps(context) {
}
});

let superblockURLS = await getDashedNamesURLs(
let superBlockJsons = await getSuperblocksByIndices(
certificationNumbers.fccCertifications
);

let superBlockJsons = await getSuperBlockJsons(superblockURLS); // this is an array of urls
let dashboardObjs = await createSuperblockDashboardObject(superBlockJsons);

let totalChallenges = getTotalChallengesForSuperblocks(dashboardObjs);
Expand Down
8 changes: 2 additions & 6 deletions pages/dashboard/v2/details/[id]/[studentEmail].js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import redirectUser from '../../../../../util/redirectUser.js';
import styles from '../../../../../components/DetailsCSS.module.css';
import DetailsDashboard from '../../../../../components/DetailsDashboard';

// NOTE: These functions are deprecated for v9 curriculum (no individual REST API JSON files)
import { getDashedNamesURLs } from '../../../../../util/legacy/getDashedNamesURLs';
import { getSuperBlockJsons } from '../../../../../util/legacy/getSuperBlockJsons';
import { getSuperblocksByIndices } from '../../../../../util/curriculum/fetchCurriculum';

export async function getServerSideProps(context) {
// Dynamic import to prevent Prisma from being bundled for client
Expand Down Expand Up @@ -72,11 +70,9 @@ export async function getServerSideProps(context) {
certificationNumbers.fccCertifications
);

let superblockURLS = await getDashedNamesURLs(
let superBlockJsons = await getSuperblocksByIndices(
certificationNumbers.fccCertifications
);

let superBlockJsons = await getSuperBlockJsons(superblockURLS); // this is an array of urls
let superblocksDetailsJSONArray = await createSuperblockDashboardObject(
superBlockJsons
);
Expand Down
Loading
Loading