brotherton-erpnext/erpnext/www/lms/course.js
2019-02-19 13:06:29 +05:30

48 lines
1.4 KiB
JavaScript

function submitQuiz() {
formData = new FormData(quiz);
var form_object = {};
formData.forEach(function (value, key) {
form_object[key] = value;
});
frappe.call({
method: "erpnext.education.utils.evaluate_quiz",
args: {
"quiz_response": form_object,
"quiz": $('#content-holder').data('content'),
"course": $('#content-holder').data('course'),
"program": $('#content-holder').data('program')
},
async: false,
callback: function (r) {
if (r) {
$("input[type=radio]").attr('disabled', true);
$("#quiz-actions").attr('hidden', true);
$("#post-quiz-actions").attr('hidden', false);
$("#result").html(r.message);
}
}
});
}
function addActivity() {
frappe.call({
method: "erpnext.education.utils.add_activity",
args: {
"content_type": $('#content-holder').data('type'),
"content": $('#content-holder').data('content'),
"course": $('#content-holder').data('course'),
"program": $('#content-holder').data('program'),
}
})
}
function addFinalActivity() {
addActivity()
frappe.call({
method: "erpnext.education.utils.mark_course_complete",
args: {
"course": $('#content-holder').data('course'),
},
})
}