fix: handle certificate challenges separately
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
5bc0187404
commit
2c78402837
@ -37,11 +37,18 @@ exports.mergeChallenges = (engChal, transChal) => {
|
|||||||
title: ${engChal.title}
|
title: ${engChal.title}
|
||||||
localeTitle: ${transChal.localeTitle}`
|
localeTitle: ${transChal.localeTitle}`
|
||||||
);
|
);
|
||||||
const translatedTests = transChal.tests.map(({ text }, id) => ({
|
|
||||||
text,
|
const translatedTests =
|
||||||
testString: engChal.tests[id].testString
|
engChal.challengeType === 7
|
||||||
}));
|
? transChal.tests.map(({ title }, i) => ({
|
||||||
return {
|
title,
|
||||||
|
id: engChal.tests[i].id
|
||||||
|
}))
|
||||||
|
: transChal.tests.map(({ text }, i) => ({
|
||||||
|
text,
|
||||||
|
testString: engChal.tests[i].testString
|
||||||
|
}));
|
||||||
|
const challenge = {
|
||||||
...engChal,
|
...engChal,
|
||||||
description: transChal.description,
|
description: transChal.description,
|
||||||
instructions: transChal.instructions,
|
instructions: transChal.instructions,
|
||||||
@ -49,6 +56,9 @@ exports.mergeChallenges = (engChal, transChal) => {
|
|||||||
forumTopicId: transChal.forumTopicId,
|
forumTopicId: transChal.forumTopicId,
|
||||||
tests: translatedTests
|
tests: translatedTests
|
||||||
};
|
};
|
||||||
|
// certificates do not have forumTopicIds
|
||||||
|
if (challenge.challengeType === 7) delete challenge.forumTopicId;
|
||||||
|
return challenge;
|
||||||
};
|
};
|
||||||
|
|
||||||
// bare urls could be interpreted as comments, so we have to lookbehind for
|
// bare urls could be interpreted as comments, so we have to lookbehind for
|
||||||
|
Reference in New Issue
Block a user