mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-26 00:58:00 -05:00
Merge branch 'master' into production
This commit is contained in:
commit
7f2366591a
5 changed files with 7 additions and 4 deletions
|
@ -6,6 +6,7 @@ PatchSchema = c.object({title: 'Patch', required: ['target', 'delta', 'commitMes
|
|||
delta: {title: 'Delta', type: ['array', 'object']}
|
||||
commitMessage: c.shortString({maxLength: 500, minLength: 1})
|
||||
creator: c.objectId(links: [{rel: 'extra', href: '/db/user/{($)}'}])
|
||||
acceptor: c.objectId(links: [{rel: 'extra', href: '/db/user/{($)}'}])
|
||||
created: c.date({title: 'Created', readOnly: true})
|
||||
status: {enum: ['pending', 'accepted', 'rejected', 'withdrawn']}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ module.exports = class LevelEditView extends RootView
|
|||
@insertSubView new ComponentsTabView supermodel: @supermodel
|
||||
@insertSubView new SystemsTabView supermodel: @supermodel
|
||||
@insertSubView new RelatedAchievementsView supermodel: @supermodel, level: @level
|
||||
@insertSubView new ComponentDocsView supermodel: @supermodel
|
||||
@insertSubView new ComponentDocsView # Don't give it the supermodel, it'll pollute it!
|
||||
|
||||
Backbone.Mediator.publish 'level-loaded', level: @level
|
||||
@showReadOnly() if me.get('anonymous')
|
||||
|
|
|
@ -53,9 +53,10 @@ PatchHandler = class PatchHandler extends Handler
|
|||
|
||||
# Only increment statistics upon very first accept
|
||||
if patch.isNewlyAccepted()
|
||||
accepter = req.user.get 'id'
|
||||
patch.set 'acceptor', req.user.get('id')
|
||||
acceptor = req.user.get 'id'
|
||||
submitter = patch.get 'creator'
|
||||
User.incrementStat accepter, 'stats.patchesAccepted'
|
||||
User.incrementStat acceptor, 'stats.patchesAccepted'
|
||||
# TODO maybe merge these increments together
|
||||
if patch.isTranslationPatch()
|
||||
User.incrementStat submitter, 'stats.totalTranslationPatches'
|
||||
|
|
|
@ -232,7 +232,7 @@ UserHandler = class UserHandler extends Handler
|
|||
|
||||
IDify: (idOrSlug, done) ->
|
||||
return done null, idOrSlug if Handler.isID idOrSlug
|
||||
User.getBySlug idOrSlug, (err, user) -> done err, user?.get '_id'
|
||||
User.findBySlug idOrSlug, (err, user) -> done err, user?.get '_id'
|
||||
|
||||
getLevelSessions: (req, res, userIDOrSlug) ->
|
||||
@IDify userIDOrSlug, (err, userID) =>
|
||||
|
|
|
@ -111,6 +111,7 @@ describe '/db/patch', ->
|
|||
expect(res.statusCode).toBe(200)
|
||||
Patch.findOne({}).exec (err, article) ->
|
||||
expect(article.get('status')).toBe 'accepted'
|
||||
expect(article.get('acceptor')).toBeDefined()
|
||||
done()
|
||||
|
||||
it 'keeps track of amount of submitted and accepted patches', (done) ->
|
||||
|
|
Loading…
Reference in a new issue