mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 18:15:52 -05:00
d445024cb6
Includes updating analytics insert script used to inject aggregated data into production database.
27 lines
819 B
CoffeeScript
27 lines
819 B
CoffeeScript
RootView = require 'views/core/RootView'
|
|
template = require 'templates/admin/analytics'
|
|
utils = require 'core/utils'
|
|
|
|
module.exports = class AnalyticsView extends RootView
|
|
id: 'admin-analytics-view'
|
|
template: template
|
|
|
|
constructor: (options) ->
|
|
super options
|
|
startDay = utils.getUTCDay(-30).replace(/-/g, '')
|
|
endDay = utils.getUTCDay(-30).replace(/-/g, '')
|
|
request = @supermodel.addRequestResource 'active_users', {
|
|
url: '/db/analytics_perday/-/active_users'
|
|
data: {startDay: startDay, endDay: endDay}
|
|
method: 'POST'
|
|
success: (data) =>
|
|
@activeUsers = data
|
|
@activeUsers.sort (a, b) -> b.day.localeCompare(a.day)
|
|
@render?()
|
|
}, 0
|
|
request.load()
|
|
|
|
getRenderData: ->
|
|
context = super()
|
|
context.activeUsers = @activeUsers ? []
|
|
context
|