mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 01:55:38 -05:00
Further changes on the Analytics view
This commit is contained in:
parent
62a027e76e
commit
8df6a182e8
3 changed files with 63 additions and 13 deletions
|
@ -1 +1,5 @@
|
||||||
#level-analytics-view
|
#level-analytics-view
|
||||||
|
.problemType
|
||||||
|
width: 50%
|
||||||
|
.problemValue
|
||||||
|
width: 50%
|
|
@ -1,4 +1,13 @@
|
||||||
extends /templates/base
|
extends /templates/base
|
||||||
|
|
||||||
block content
|
block content
|
||||||
table#levelTable
|
table.table.table-striped#levelTable
|
||||||
|
for level in (view.parsedLevels || [])
|
||||||
|
tr
|
||||||
|
td(style="width:10%")= level.level.get('slug')
|
||||||
|
td
|
||||||
|
table.table-striped
|
||||||
|
for problem in (level.problems || [])
|
||||||
|
tr(style="width:100%")
|
||||||
|
td.problemType= problem.type
|
||||||
|
td.problemValue= problem.value
|
|
@ -36,29 +36,66 @@ module.exports = class LevelAnalyticsView extends RootView
|
||||||
continue unless excludedCampaigns.indexOf(campaign.get 'slug') is -1
|
continue unless excludedCampaigns.indexOf(campaign.get 'slug') is -1
|
||||||
levels = campaign.get('levels')
|
levels = campaign.get('levels')
|
||||||
for key, level of levels
|
for key, level of levels
|
||||||
@levelSlugs.push level.slug
|
if @levelSlugs.indexOf(level.slug) is -1
|
||||||
|
@levelSlugs.push level.slug
|
||||||
if @levels.models.length isnt 0
|
if @levels.models.length isnt 0
|
||||||
@readyUp()
|
@readyUp()
|
||||||
|
console.log @levelSlugs.length
|
||||||
|
|
||||||
onLevelsLoaded: ->
|
onLevelsLoaded: ->
|
||||||
console.log @levels
|
#console.log @levels
|
||||||
if @campaigns.models.length isnt 0
|
if @campaigns.models.length isnt 0
|
||||||
@readyUp()
|
@readyUp()
|
||||||
|
|
||||||
readyUp: ->
|
readyUp: ->
|
||||||
|
@parsedLevels = []
|
||||||
for levelSlug in @levelSlugs
|
for levelSlug in @levelSlugs
|
||||||
level = @levels.findWhere({slug:levelSlug})
|
level = @levels.findWhere({slug:levelSlug})
|
||||||
unless level?
|
unless level?
|
||||||
|
#console.log("Level missing from @levels: " + levelSlug)
|
||||||
continue
|
continue
|
||||||
console.warn('Warning: ' + levelSlug) unless level?
|
|
||||||
console.log levelSlug
|
|
||||||
|
|
||||||
thangs = level.get('thangs')
|
thangs = level.get('thangs')
|
||||||
for thang in thangs
|
component = null
|
||||||
for component in thang.components
|
thang = _.findWhere(thangs, (elem) ->
|
||||||
if component.config?.programmableMethods?
|
return _.findWhere(elem.components, (elem2) ->
|
||||||
console.log "HI!"
|
if elem2.config?.programmableMethods?.plan?
|
||||||
break
|
component = elem2
|
||||||
console.log thang
|
return true
|
||||||
break
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
unless thang? and component?
|
||||||
|
console.log("Cannot find programmableMethods component in: " + levelSlug)
|
||||||
|
continue
|
||||||
|
unless component?.config?.programmableMethods?.plan?
|
||||||
|
console.log("Cannot find plannable method inside component: " + levelSlug)
|
||||||
|
continue
|
||||||
|
solutions = component.config.programmableMethods.plan.solutions
|
||||||
|
|
||||||
|
problems = []
|
||||||
|
for lang in ["python", "javascript", "lua"]
|
||||||
|
unless _.findWhere(solutions, (elem) -> return elem.language is lang)
|
||||||
|
problems.push {
|
||||||
|
"type":"Missing Solution Language",
|
||||||
|
"value":lang
|
||||||
|
}
|
||||||
|
for solutionIndex of solutions
|
||||||
|
solution = solutions[solutionIndex]
|
||||||
|
for req in ["seed", "succeeds", "heroConfig"]
|
||||||
|
unless solution[req]?
|
||||||
|
problems.push {
|
||||||
|
"type":"Solution is not simulatable",
|
||||||
|
"value":solution.language
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
@parsedLevels.push {
|
||||||
|
level: level
|
||||||
|
problems: problems
|
||||||
|
}
|
||||||
|
console.log @parsedLevels.length
|
||||||
|
@renderSelectors '#levelTable'
|
||||||
###
|
###
|
||||||
@levels = []
|
@levels = []
|
||||||
for campaign in @campaigns.models
|
for campaign in @campaigns.models
|
||||||
|
|
Loading…
Reference in a new issue