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

Function findParentLevelOriginal

app/core/utils.js:1048–1059  ·  view source on GitHub ↗
(level, levelsArr)

Source from the content-addressed store, hash-verified

1046// Practice level slugs are <mainLevelSlug>-[a-z]; the DB only stores locks on the parent level
1047// this works on junior only as they have practice levels related to parent level
1048const findParentLevelOriginal = function (level, levelsArr) {
1049 if (!level) return
1050 let lockCheckOriginal = level.original
1051 if (level.practice) {
1052 const mainSlug = level.slug?.replace(/-[a-z]$/, '')
1053 const mainLevel = levelsArr.find(l => l.slug === mainSlug)
1054 if (mainLevel) {
1055 lockCheckOriginal = mainLevel.original
1056 }
1057 }
1058 return lockCheckOriginal
1059}
1060
1061const findNextAssessmentForLevel = function (levels, currentIndex, needsPractice) {
1062 // Find assessment level immediately after current level (and its practice levels)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected