MCPcopy Index your code
hub / github.com/codecombat/codecombat / getSolutionsMap

Method getSolutionsMap

app/collections/Levels.js:42–54  ·  view source on GitHub ↗
(languages)

Source from the content-addressed store, hash-verified

40 }
41
42 getSolutionsMap (languages) {
43 return this.models.reduce((map, level) => {
44 const targetLangs = level.get('primerLanguage') ? [level.get('primerLanguage')] : languages
45 const allSolutions = _.filter(level.getSolutions(), s => !s.testOnly)
46 let solutions = this.constructor.getSolutionsHelper({ targetLangs, allSolutions })
47 if (level.get('product') === 'codecombat-junior') {
48 solutions = _.filter(solutions, (s) => s.succeeds) // Don't show unsuccessful test case solutions
49 }
50 map[level.get('original')] = solutions != null ? solutions.map(s => ({ source: this.fingerprint(s.source, s.language), description: s.description })) : undefined
51 return map
52 }
53 , {})
54 }
55
56 static getSolutionsHelper ({ targetLangs, allSolutions }) {
57 const solutions = []

Callers 2

updateSolutionsMethod · 0.80
updateLevelDataMethod · 0.80

Calls 5

fingerprintMethod · 0.95
filterMethod · 0.80
getSolutionsMethod · 0.80
getSolutionsHelperMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected