Remove analytics.log.event created field

_id field already has created data:
http://docs.mongodb.org/manual/reference/object-id/
Also some misc analytics cleanup.
This commit is contained in:
Matt Lott 2015-01-14 13:03:02 -08:00
parent 140a93b453
commit e79cadc761
5 changed files with 7 additions and 9 deletions

View file

@ -6,7 +6,6 @@ AnalyticsLogEventSchema = c.object {
}
_.extend AnalyticsLogEventSchema.properties,
created: c.date({title: 'Created', readOnly: true})
user: c.objectId(links: [{rel: 'extra', href: '/db/user/{($)}'}])
event: {type: 'string'}
properties: {type: 'object'}

View file

@ -7,6 +7,7 @@ AnalyticsPerDaySchema = c.object {
_.extend AnalyticsPerDaySchema.properties,
d: {type: 'string'} # yyyymmdd day, e.g. '20150123'
e: {type: 'integer'} # event (analytics string ID from analytics.strings)
l: {type: 'integer'} # level (analytics ID from analytics.strings)
f: {type: 'integer'} # filter (analytics ID from analytics.strings)
fv: {type: 'integer'} # filter value (analytics ID from analytics.strings)

View file

@ -1,11 +1,7 @@
mongoose = require 'mongoose'
plugins = require '../plugins/plugins'
AnalyticsLogEventSchema = new mongoose.Schema({
created:
type: Date
'default': Date.now
}, {strict: false})
AnalyticsLogEventSchema.index({event: 1, created: -1})
AnalyticsLogEventSchema = new mongoose.Schema({}, {strict: false})
AnalyticsLogEventSchema.index({event: 1, _id: 1})
module.exports = AnalyticsLogEvent = mongoose.model('analytics.log.event', AnalyticsLogEventSchema)

View file

@ -1,6 +1,7 @@
mongoose = require 'mongoose'
AnalyticsPerDaySchema = new mongoose.Schema({
d: {type: String} # yyyymmdd day, e.g. '20150123'
e: {type: Number} # event (analytics string ID from analytics.strings)
l: {type: Number} # level (analytics string ID from analytics.strings)
f: {type: Number} # filter (analytics string ID from analytics.strings)

View file

@ -22,8 +22,9 @@ class AnalyticsLogEventHandler extends Handler
instance
getByRelationship: (req, res, args...) ->
return @getLevelCompletionsBySlug(req, res) if args[1] is 'level_completions'
return @getCampaignCompletionsBySlug(req, res) if args[1] is 'campaign_completions'
# TODO: Remove these APIs
# return @getLevelCompletionsBySlug(req, res) if args[1] is 'level_completions'
# return @getCampaignCompletionsBySlug(req, res) if args[1] is 'campaign_completions'
super(arguments...)
getLevelCompletionsBySlug: (req, res) ->