| 548 | // Ozaria-specific |
| 549 | // adds displayName and learning goals from intro levels content to the intro level given |
| 550 | const 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 | |
| 570 | const normalizeFunc = function (func_thing, object) { |
| 571 | // func could be a string to a function in this class |