MCPcopy Create free account
hub / github.com/codecombat/codecombat / addIntroLevelContent

Function addIntroLevelContent

app/core/utils.js:550–568  ·  view source on GitHub ↗
(introLevel, introLevelsContent)

Source from the content-addressed store, hash-verified

548// Ozaria-specific
549// adds displayName and learning goals from intro levels content to the intro level given
550const addIntroLevelContent = function (introLevel, introLevelsContent) {
551 if ((introLevel.get('type') === 'intro') && ((introLevel.get('introContent') || []).length > 0) && introLevelsContent) {
552 return introLevel.get('introContent').forEach(c => {
553 let introLevelData
554 if (c.type === 'avatarSelectionScreen') { return }
555 if (typeof c.contentId === 'object') { // contentId can be an object if interactive is different for python/js
556 // for simplicity, assuming that the display name/learning goals will be same for a given interactive in python/js
557 introLevelData = introLevelsContent[c.contentId.python] || {}
558 } else {
559 introLevelData = introLevelsContent[c.contentId] || {}
560 }
561 c.displayName = i18n(introLevelData, 'displayName') || i18n(introLevelData, 'name')
562 const learningGoals = ((introLevelData.documentation || {}).specificArticles || []).find(a => a.name === 'Learning Goals')
563 if (learningGoals) {
564 return c.learningGoals = i18n(learningGoals, 'body')
565 }
566 })
567 }
568}
569
570const normalizeFunc = function (func_thing, object) {
571 // func could be a string to a function in this class

Callers

nothing calls this directly

Calls 2

i18nFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected