fix: handle video challenges

This commit is contained in:
Oliver Eyton-Williams
2020-08-13 12:25:53 +02:00
committed by Mrugesh Mohapatra
parent a66455b983
commit 1ec6cf1efd
4 changed files with 96 additions and 32 deletions

View File

@ -93,14 +93,17 @@ async function buildCurriculum(file, curriculum) {
async function parseTranslation(engPath, transPath, dict) {
const engChal = await parseMarkdown(engPath);
const translatedChal = await parseMarkdown(transPath);
const codeLang = engChal.files[0] ? engChal.files[0].ext : null;
const codeLang =
engChal.files && engChal.files[0] ? engChal.files[0].ext : null;
const engWithTranslatedComments = translateCommentsInChallenge(
engChal,
getChallengeLang(transPath),
dict,
codeLang
);
const engWithTranslatedComments = codeLang
? translateCommentsInChallenge(
engChal,
getChallengeLang(transPath),
dict,
codeLang
)
: engChal;
return mergeChallenges(engWithTranslatedComments, translatedChal);
}