diff --git a/app/templates/editor/campaign/campaign-editor-view.jade b/app/templates/editor/campaign/campaign-editor-view.jade index aeb4b4e33..98d9d6f5c 100644 --- a/app/templates/editor/campaign/campaign-editor-view.jade +++ b/app/templates/editor/campaign/campaign-editor-view.jade @@ -68,7 +68,12 @@ block outer_content td= campaignCompletions.levels[i].level td= campaignCompletions.levels[i].started td= campaignCompletions.levels[i].finished - td= campaignCompletions.levels[i].completionRate + 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... diff --git a/app/views/editor/campaign/CampaignEditorView.coffee b/app/views/editor/campaign/CampaignEditorView.coffee index cfa84d2d5..f9e0959c1 100644 --- a/app/views/editor/campaign/CampaignEditorView.coffee +++ b/app/views/editor/campaign/CampaignEditorView.coffee @@ -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()