MCPcopy Create free account
hub / github.com/freeCodeCamp/freeCodeCamp / fetchChallenges

Function fetchChallenges

tools/daily-challenges/helpers.ts:27–62  ·  view source on GitHub ↗
(language: 'javascript' | 'python')

Source from the content-addressed store, hash-verified

25}
26
27export async function fetchChallenges(language: 'javascript' | 'python') {
28 const query = `
29query {
30 allChallengeNode(
31 filter: {challenge: {superBlock: {eq: "dev-playground"}, block: {eq: "daily-coding-challenges-${language}"}}}
32 sort: {challenge: {challengeOrder: ASC}}
33 ) {
34 edges {
35 node {
36 challenge {
37 id
38 title
39 description
40 tests {
41 testString
42 text
43 }
44 challengeFiles {
45 contents
46 fileKey
47 }
48 }
49 }
50 }
51 }
52}
53`;
54
55 const queryRes = await queryGraphQL(query);
56
57 const challenges = queryRes.data.allChallengeNode.edges.map(
58 ({ node }) => node.challenge
59 );
60
61 return challenges;
62}
63
64export function combineChallenges({
65 jsChallenge,

Callers 1

seedFunction · 0.90

Calls 1

queryGraphQLFunction · 0.85

Tested by

no test coverage detected