mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 10:06:08 -05:00
Mark top3 and bottom3 levels in campaign analytics
This commit is contained in:
parent
e499678223
commit
e67532cf5d
2 changed files with 12 additions and 1 deletions
|
@ -68,6 +68,11 @@ block outer_content
|
|||
td= campaignCompletions.levels[i].level
|
||||
td= campaignCompletions.levels[i].started
|
||||
td= campaignCompletions.levels[i].finished
|
||||
if campaignCompletions.top3.indexOf(campaignCompletions.levels[i].level) >= 0
|
||||
td(style='background-color:lightblue;')= campaignCompletions.levels[i].completionRate
|
||||
else if campaignCompletions.bottom3.indexOf(campaignCompletions.levels[i].level) >= 0
|
||||
td(style='background-color:pink;')= campaignCompletions.levels[i].completionRate
|
||||
else
|
||||
td= campaignCompletions.levels[i].completionRate
|
||||
else
|
||||
button.btn.btn-default.disabled#analytics-button Analytics Loading...
|
||||
|
|
|
@ -252,6 +252,12 @@ module.exports = class CampaignEditorView extends RootView
|
|||
item.completionRate = (item.finished / item.started * 100).toFixed(2)
|
||||
item
|
||||
@campaignCompletions = levels: _.map data, mapFn, @
|
||||
sortedLevels = _.cloneDeep @campaignCompletions.levels
|
||||
sortedLevels = _.filter sortedLevels, ((a) -> a.completionRate > 1.0), @
|
||||
sortedLevels.sort (a, b) -> b.completionRate - a.completionRate
|
||||
@campaignCompletions.top3 = _.pluck sortedLevels[0..2], 'level'
|
||||
sortedLevels.sort (a, b) -> a.completionRate - b.completionRate
|
||||
@campaignCompletions.bottom3 = _.pluck sortedLevels[0..2], 'level'
|
||||
@campaignCompletions.startDay = "#{startDay[0..3]}-#{startDay[4..5]}-#{startDay[6..7]}"
|
||||
@campaignCompletions.endDay = "#{endDay[0..3]}-#{endDay[4..5]}-#{endDay[6..7]}"
|
||||
@render()
|
||||
|
|
Loading…
Reference in a new issue