brotherton-erpnext/erpnext/www/lms/course.js

48 lines
1.4 KiB
JavaScript
Raw Normal View History

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,
2018-10-19 08:36:14 +00:00
"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'),
}
})
2018-10-18 10:14:08 +00:00
}
2018-10-24 11:16:46 +00:00
function addFinalActivity() {
addActivity()
frappe.call({
method: "erpnext.education.utils.mark_course_complete",
args: {
"course": $('#content-holder').data('course'),
},
})
}