Using lms.call across the Vue app

This commit is contained in:
scmmishra
2018-11-19 15:12:39 +05:30
committed by Aditya Hase
parent 0a4902f8b5
commit 80ecc56cbe
5 changed files with 68 additions and 70 deletions

View File

@@ -52,32 +52,35 @@ export default {
}
},
mounted() {
frappe.call({
method: "erpnext.www.lms.get_quiz_without_answers",
args: {
quiz_name: this.content,
}
}).then(r => {
this.quizData = r.message
this.getQuizWithoutAnswers().then(data => {
this.quizData = data
});
},
components: {
QuizSingleChoice,
},
methods: {
getQuizWithoutAnswers() {
return lms.call({
method: "get_quiz_without_answers",
args: {
quiz_name: this.content,
}
})
},
updateResponse(res) {
this.quizResponse[res.question] = (res.option)
},
submitQuiz() {
frappe.call({
method: "erpnext.www.lms.evaluate_quiz",
lms.call({
method: "evaluate_quiz",
args: {
enrollment: lms.store.enrolledCourses[this.$route.params.course],
quiz_response: this.quizResponse,
quiz_name: this.content
}
}).then(r => {
this.score = r.message,
}).then(data => {
this.score = data,
this.submitted = true,
this.quizResponse = null
});