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

Function findFirstIncompleteLevelOfPreviousPracticeChain

app/core/utils.js:990–1008  ·  view source on GitHub ↗
(levels, currentIndex)

Source from the content-addressed store, hash-verified

988}
989
990const findFirstIncompleteLevelOfPreviousPracticeChain = function (levels, currentIndex) {
991 let index = skipNonPracticeLevels(levels, currentIndex - 1)
992
993 if (index >= 0) {
994 index = skipPracticeLevels(levels, index)
995
996 if (index >= 0) {
997 index++
998
999 // Skip completed practice levels
1000 while ((index < levels.length) && isPractice(levels[index]) && levels[index].complete) { index++ }
1001
1002 if (isLocked(levels[index])) { return -1 }
1003 if (isPractice(levels[index]) && !levels[index].complete) { return index }
1004 }
1005 }
1006
1007 return -1
1008}
1009
1010const isAnyPrecedingLevelLocked = function (levels, currentIndex) {
1011 for (let i = 0, end = currentIndex, asc = end >= 0; asc ? i <= end : i >= end; asc ? i++ : i--) {

Callers 1

findNextLevelFunction · 0.85

Calls 4

skipNonPracticeLevelsFunction · 0.85
skipPracticeLevelsFunction · 0.85
isPracticeFunction · 0.85
isLockedFunction · 0.85

Tested by

no test coverage detected