Cleaned up achievement testing environment

Made sure server sided tests work completely
This commit is contained in:
Ruben Vereecken 2014-06-09 11:59:27 +02:00
parent 2a5c2020ca
commit aecf937722
5 changed files with 15 additions and 17 deletions

View file

@ -33,3 +33,11 @@ block content
a(href="/admin/base", data-i18n="admin.av_other_debug_base_url") Base (for debugging base.jade)
li
a(href="/admin/clas", data-i18n="admin.clas") CLAs
hr
h3 Achievements
p This is just some stuff for temporary achievement testing. Should be replaced by a demo system.
input#increment-field(type="text")
a.btn.btn-secondary#increment-button(href="#") Increment

View file

@ -8,6 +8,7 @@ module.exports = class AdminView extends View
events:
'click #enter-espionage-mode': 'enterEspionageMode'
'click #increment-button': 'incrementUserAttribute'
enterEspionageMode: ->
userEmail = $("#user-email").val().toLowerCase()
@ -29,3 +30,8 @@ module.exports = class AdminView extends View
espionageFailure: (jqxhr, status,error)->
console.log "There was an error entering espionage mode: #{error}"
incrementUserAttribute: (e) ->
val = $('#increment-field').val()
me.set(val, me.get(val) + 1)
me.save()

View file

@ -26,20 +26,6 @@ module.exports = class RootView extends CocoView
subscriptions:
'achievements:new': 'handleNewAchievements'
initialize: ->
$ =>
# TODO Ruben remove this. Allows for easy testing right now though
btn = $('<a href="#" id="testbtn" class="btn">Increment</a>')
input = $('<input type="text" id="testinp">')
$('body').append(btn)
$('body').append(input)
btn.on 'click', (e) =>
val = input.val()
me.set(val, me.get(val) + 1)
console.debug me.get(val)
me.save()
#test = new Achievement(_id:'537ce4855c91b8d1dda7fda8')
#test.fetch(success:@showNewAchievement)
showNewAchievement: (achievement, earnedAchievement) ->
currentLevel = me.level()

View file

@ -1,6 +1,5 @@
mongoose = require 'mongoose'
jsonschema = require '../../app/schemas/models/earned_achievement'
User = require '../users/User'
EarnedAchievementSchema = new mongoose.Schema({
created:

View file

@ -24,9 +24,8 @@ candidateProperties = [
UserHandler = class UserHandler extends Handler
modelClass: User
# TODO Ruben change this back! Really really do. Don't you dare forget. NO COOKIES
editableProperties: [
'name', 'photoURL', 'password', 'anonymous', 'wizardColor1', 'volume', 'simulatedBy',
'name', 'photoURL', 'password', 'anonymous', 'wizardColor1', 'volume',
'firstName', 'lastName', 'gender', 'facebookID', 'gplusID', 'emails',
'testGroupNumber', 'music', 'hourOfCode', 'hourOfCodeComplete', 'preferredLanguage',
'wizard', 'aceConfig', 'autocastDelay', 'lastLevel', 'jobProfile'