From cfc35f44240f8c648bcbba23cd2455f772ac4177 Mon Sep 17 00:00:00 2001 From: scmmishra Date: Fri, 2 Nov 2018 12:51:51 +0530 Subject: [PATCH] Quiz: Save responses as an object --- erpnext/education/doctype/quiz/quiz.json | 21 ++++++++++++++++++- .../web-academy/components/ContentQuiz.vue | 13 +++++++++--- .../components/Quiz/QuizSingleChoice.vue | 17 ++++++++++++--- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/erpnext/education/doctype/quiz/quiz.json b/erpnext/education/doctype/quiz/quiz.json index 6284d92f71..25b9690451 100644 --- a/erpnext/education/doctype/quiz/quiz.json +++ b/erpnext/education/doctype/quiz/quiz.json @@ -154,7 +154,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-10-17 06:57:18.235274", + "modified": "2018-11-02 10:58:56.590859", "modified_by": "Administrator", "module": "Education", "name": "Quiz", @@ -179,6 +179,25 @@ "share": 1, "submit": 0, "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 0, + "delete": 0, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "LMS User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 0 } ], "quick_entry": 1, diff --git a/erpnext/public/js/education/web-academy/components/ContentQuiz.vue b/erpnext/public/js/education/web-academy/components/ContentQuiz.vue index adff3ccfe0..3828cdfb7b 100644 --- a/erpnext/public/js/education/web-academy/components/ContentQuiz.vue +++ b/erpnext/public/js/education/web-academy/components/ContentQuiz.vue @@ -6,11 +6,12 @@

{{ content }}

+ {{ quizResponse }}

- +
@@ -43,7 +44,8 @@ export default { name: 'ContentQuiz', data() { return { - quizData: '' + quizData: '', + quizResponse: {} } }, mounted() { @@ -58,7 +60,12 @@ export default { }, components: { QuizSingleChoice, - } + }, + methods: { + updateResponse(res) { + this.quizResponse[res.question] = (res.option) + } + } }; diff --git a/erpnext/public/js/education/web-academy/components/Quiz/QuizSingleChoice.vue b/erpnext/public/js/education/web-academy/components/Quiz/QuizSingleChoice.vue index 0e28a141ed..492c265f86 100644 --- a/erpnext/public/js/education/web-academy/components/Quiz/QuizSingleChoice.vue +++ b/erpnext/public/js/education/web-academy/components/Quiz/QuizSingleChoice.vue @@ -2,12 +2,13 @@
{{ question.question }}
-
- -
@@ -16,6 +17,16 @@ export default { props: ['question'], name: 'QuizSingleChoice', + data() { + return { + picked: '' + } + }, + methods: { + emitResponse(q, o) { + this.$emit('updateResponse', {'question':q , 'option': o}) + } + } };