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}
|
||||
localeTitle: ${transChal.localeTitle}`
|
||||
);
|
||||
const translatedTests = transChal.tests.map(({ text }, id) => ({
|
||||
|
||||
const translatedTests =
|
||||
engChal.challengeType === 7
|
||||
? transChal.tests.map(({ title }, i) => ({
|
||||
title,
|
||||
id: engChal.tests[i].id
|
||||
}))
|
||||
: transChal.tests.map(({ text }, i) => ({
|
||||
text,
|
||||
testString: engChal.tests[id].testString
|
||||
testString: engChal.tests[i].testString
|
||||
}));
|
||||
return {
|
||||
const challenge = {
|
||||
...engChal,
|
||||
description: transChal.description,
|
||||
instructions: transChal.instructions,
|
||||
@ -49,6 +56,9 @@ exports.mergeChallenges = (engChal, transChal) => {
|
||||
forumTopicId: transChal.forumTopicId,
|
||||
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
|
||||
|
Reference in New Issue
Block a user