codecombat/app/models/Achievement.coffee

17 lines
621 B
CoffeeScript
Raw Normal View History

CocoModel = require './CocoModel'
utils = require '../lib/utils'
module.exports = class Achievement extends CocoModel
@className: 'Achievement'
@schema: require 'schemas/models/achievement'
urlRoot: '/db/achievement'
isRepeatable: ->
2014-06-17 15:42:27 -04:00
@get('proportionalTo')?a
# TODO logic is duplicated in Mongoose Achievement schema
getExpFunction: ->
kind = @get('function')?.kind or jsonschema.properties.function.default.kind
parameters = @get('function')?.parameters or jsonschema.properties.function.default.parameters
2014-06-12 13:39:45 -04:00
return utils.functionCreators[kind](parameters) if kind of utils.functionCreators