mirror of
https://github.com/zhigang1992/deployd.git
synced 2026-06-11 15:53:26 +08:00
1 line
2.1 KiB
Plaintext
Executable File
1 line
2.1 KiB
Plaintext
Executable File
{"4847ecf6ba61cbf0":{"properties":{"correctAnswer":{"required":false,"type":"string","typeLabel":"string","id":"correctAnswer"},"answerD":{"required":false,"type":"string","typeLabel":"string","id":"answerD"},"answerC":{"required":false,"type":"string","typeLabel":"string","id":"answerC"},"answerB":{"required":false,"type":"string","typeLabel":"string","id":"answerB"},"answerA":{"required":false,"type":"string","typeLabel":"string","id":"answerA"},"text":{"required":false,"type":"string","typeLabel":"string","id":"text"},"questionNumber":{"required":false,"type":"number","typeLabel":"string","id":"questionNumber"}},"onGet":"hide('correctAnswer');\nvar self = this;\n\ndpd.responses.get({questionId: this.id}, function(responses, err) {\n var correctCount = 0;\n var totalCount = 0;\n if (responses) {\n totalCount = responses.length;\n responses.forEach(function(r) {\n if (r.isCorrect) correctCount++;\n });\n }\n \n if (totalCount) {\n self.correctPercentage = correctCount/totalCount;\n }\n})","onPost":"cancel();","onPut":"cancel();","onDelete":"cancel();","onValidate":"","path":"/questions","order":1,"typeLabel":"Collection","type":"Collection","$renameFrom":"/questions"},"da314be65f6b0853":{"properties":{"answer":{"required":true,"type":"string","typeLabel":"string","id":"answer"},"twitterHandle":{"required":true,"type":"string","typeLabel":"string","id":"twitterHandle"},"questionId":{"required":true,"type":"string","typeLabel":"string","id":"questionId"},"isCorrect":{"required":false,"type":"boolean","typeLabel":"boolean","id":"isCorrect"}},"onGet":"","onPost":"this.isCorrect = false;\ndpd.questions.get(this.questionId, function(q) {\n if (q && q.correctAnswer === this.answer) {\n this.isCorrect = true;\n }\n});\n\nif (this.twitterHandle.indexOf('@') !== 0) {\n this.twitterHandle = '@' + this.twitterHandle;\n}\n\nemit('statUpdate', this.questionId);","onPut":"cancel();","onDelete":"cancel();","onValidate":"","path":"/responses","order":2,"typeLabel":"Collection","type":"Collection","$renameFrom":"/responses"}} |