mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-24 16:17:57 -05:00
a933f9737d
intermediate
16 lines
621 B
CoffeeScript
16 lines
621 B
CoffeeScript
CocoModel = require './CocoModel'
|
|
utils = require '../lib/utils'
|
|
|
|
module.exports = class Achievement extends CocoModel
|
|
@className: 'Achievement'
|
|
@schema: require 'schemas/models/achievement'
|
|
urlRoot: '/db/achievement'
|
|
|
|
isRepeatable: ->
|
|
@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
|
|
return utils.functionCreators[kind](parameters) if kind of utils.functionCreators
|