mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Group concept map by campaign.
This commit is contained in:
parent
75e3c54d54
commit
6c9f351f01
2 changed files with 51 additions and 42 deletions
|
@ -8,13 +8,17 @@ block content
|
||||||
span.glyphicon.glyphicon-chevron-left
|
span.glyphicon.glyphicon-chevron-left
|
||||||
span Artisans Home
|
span Artisans Home
|
||||||
br
|
br
|
||||||
table.table.table-striped#level-table
|
for course, k in (view.data || {})
|
||||||
|
h3= k
|
||||||
|
table.table.table-striped
|
||||||
tr
|
tr
|
||||||
|
th No
|
||||||
th Level Name
|
th Level Name
|
||||||
th Concepts Detected
|
th Concepts Detected
|
||||||
for level in (view.parsedLevels || [])
|
for level in course
|
||||||
tr
|
tr
|
||||||
td(style="width:10%")= level.level.get('name')
|
td= level.seqNo
|
||||||
|
td(style="width:10%")= level.get('name')
|
||||||
td
|
td
|
||||||
for tag in (level.tags || [])
|
for tag in (level.tags || [])
|
||||||
span.label.label-primary(style='margin-right: 10px; float: left; line-height: 20px; margin-bottom: 10px')= tag
|
span.label.label-primary(style='margin-right: 10px; float: left; line-height: 20px; margin-bottom: 10px')= tag
|
|
@ -37,7 +37,7 @@ module.exports = class LevelConceptMap extends RootView
|
||||||
unloadedCampaigns: 0
|
unloadedCampaigns: 0
|
||||||
campaignLevels: {}
|
campaignLevels: {}
|
||||||
loadedLevels: {}
|
loadedLevels: {}
|
||||||
parsedLevels: []
|
data: {}
|
||||||
problemCount: 0
|
problemCount: 0
|
||||||
|
|
||||||
initialize: ->
|
initialize: ->
|
||||||
|
@ -55,20 +55,25 @@ module.exports = class LevelConceptMap extends RootView
|
||||||
@unloadedCampaigns++
|
@unloadedCampaigns++
|
||||||
|
|
||||||
@campaignLevels[campaignSlug] = new Levels()
|
@campaignLevels[campaignSlug] = new Levels()
|
||||||
@listenTo(@campaignLevels[campaignSlug], 'sync', @onLevelsLoaded)
|
@listenTo(@campaignLevels[campaignSlug], 'sync', @onLevelsLoaded.bind @, campaignSlug)
|
||||||
@supermodel.trackRequest(@campaignLevels[campaignSlug].fetchForCampaign(campaignSlug,
|
@supermodel.trackRequest(@campaignLevels[campaignSlug].fetchForCampaign(campaignSlug,
|
||||||
data:
|
data:
|
||||||
project: 'thangs,name,slug,campaign'
|
project: 'thangs,name,slug,campaign'
|
||||||
))
|
))
|
||||||
|
|
||||||
onLevelsLoaded: (lvlCollection) ->
|
onLevelsLoaded: (campaignSlug, lvlCollection) ->
|
||||||
for level in lvlCollection.models
|
for level, k in lvlCollection.models
|
||||||
@loadedLevels[level.get('slug')] = level
|
level.campaign = campaignSlug
|
||||||
|
@loadedLevels[campaignSlug] = {} unless @loadedLevels[campaignSlug]?
|
||||||
|
ll = {} unless ll?
|
||||||
|
level.seqNo = lvlCollection.models.length - k
|
||||||
|
@loadedLevels[campaignSlug][level.get('slug')] = level
|
||||||
if --@unloadedCampaigns is 0
|
if --@unloadedCampaigns is 0
|
||||||
@onAllLevelsLoaded()
|
@onAllLevelsLoaded()
|
||||||
|
|
||||||
onAllLevelsLoaded: ->
|
onAllLevelsLoaded: ->
|
||||||
for levelSlug, level of @loadedLevels
|
for campaignSlug, campaign of @loadedLevels
|
||||||
|
for levelSlug, level of campaign
|
||||||
unless level?
|
unless level?
|
||||||
console.error 'Level Slug doesn\'t have associated Level', levelSlug
|
console.error 'Level Slug doesn\'t have associated Level', levelSlug
|
||||||
continue
|
continue
|
||||||
|
@ -97,11 +102,11 @@ module.exports = class LevelConceptMap extends RootView
|
||||||
continue
|
continue
|
||||||
|
|
||||||
plan = component.config.programmableMethods.plan
|
plan = component.config.programmableMethods.plan
|
||||||
@parsedLevels.push
|
level.tags = @tagLevel _.find plan.solutions, (s) -> s.language is 'javascript'
|
||||||
level: level
|
@data[campaignSlug] = _.sortBy _.values(@loadedLevels[campaignSlug]), 'seqNo'
|
||||||
tags: @tagLevel _.find plan.solutions, (s) -> s.language is 'javascript'
|
|
||||||
|
|
||||||
@renderSelectors '#level-table'
|
console.log @render, @loadedLevels
|
||||||
|
@render()
|
||||||
|
|
||||||
tagLevel: (src) ->
|
tagLevel: (src) ->
|
||||||
return [] if not src?.source?
|
return [] if not src?.source?
|
||||||
|
|
Loading…
Reference in a new issue