mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Update campaign editor analytics
Color in level name based on number of users remaining.
This commit is contained in:
parent
e00e699e6f
commit
499e7c2999
3 changed files with 13 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
|||
#campaign-analytics-modal
|
||||
.modal-dialog
|
||||
width: 75%
|
||||
.level-name-container
|
||||
position: relative
|
||||
.level-name-background
|
||||
position: absolute
|
||||
height: 100%
|
||||
left: 0px
|
||||
top: 0px
|
||||
background-color: green
|
||||
opacity: 0.25
|
||||
|
|
|
@ -24,7 +24,8 @@ block modal-body-content
|
|||
tbody
|
||||
- for (var i = 0; i < campaignCompletions.levels.length; i++)
|
||||
tr
|
||||
td= campaignCompletions.levels[i].level
|
||||
td.level-name-container= campaignCompletions.levels[i].level
|
||||
span.level-name-background(style="width:#{campaignCompletions.levels[i].usersRemaining || 0}%;")
|
||||
td= campaignCompletions.levels[i].started
|
||||
td= campaignCompletions.levels[i].finished
|
||||
td= campaignCompletions.levels[i].dropped
|
||||
|
|
|
@ -101,8 +101,10 @@ module.exports = class CampaignAnalyticsModal extends ModalView
|
|||
success = (data) =>
|
||||
return if @destroyed
|
||||
# console.log 'getCampaignLevelCompletions success', data
|
||||
maxStarted = if data.length > 0 then (_.max data, ((a) -> a.started)).started else 0
|
||||
mapFn = (item) ->
|
||||
item.completionRate = if item.started > 0 then (item.finished / item.started * 100).toFixed(2) else 0.0
|
||||
item.usersRemaining = Math.round(item.started / maxStarted * 100.0) unless maxStarted is 0
|
||||
item
|
||||
@campaignCompletions.levels = _.map data, mapFn, @
|
||||
|
||||
|
|
Loading…
Reference in a new issue