diff --git a/lms/lms/doctype/lms_payment/lms_payment.js b/lms/lms/doctype/lms_payment/lms_payment.js index 11d42cab..b2d03500 100644 --- a/lms/lms/doctype/lms_payment/lms_payment.js +++ b/lms/lms/doctype/lms_payment/lms_payment.js @@ -1,8 +1,14 @@ // Copyright (c) 2023, Frappe and contributors // For license information, please see license.txt -// frappe.ui.form.on("LMS Payment", { -// refresh(frm) { - -// }, -// }); +frappe.ui.form.on("LMS Payment", { + onload(frm) { + frm.set_query("member", function (doc) { + return { + filters: { + ignore_user_type: 1, + }, + }; + }); + }, +}); diff --git a/lms/lms/doctype/lms_quiz/lms_quiz.py b/lms/lms/doctype/lms_quiz/lms_quiz.py index 709cfe34..bbaaabb7 100644 --- a/lms/lms/doctype/lms_quiz/lms_quiz.py +++ b/lms/lms/doctype/lms_quiz/lms_quiz.py @@ -110,6 +110,7 @@ def quiz_summary(quiz, results): "score_out_of": score_out_of, "submission": submission.name, "pass": percentage == quiz_details.passing_percentage, + "percentage": percentage, } diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 473066b4..70f186fc 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -667,10 +667,17 @@ def notify_mentions(doc, topic): subject = _("{0} mentioned you in a comment").format(sender_fullname) template = "mention_template" + if topic.reference_doctype == "LMS Batch": + link = f"/batches/{topic.reference_docname}#discussions" + if topic.reference_doctype == "Course Lesson": + course = frappe.db.get_value("Course Lesson", topic.reference_docname, "course") + lesson_index = get_lesson_index(topic.reference_docname) + link = get_lesson_url(course, lesson_index) + args = { "sender": sender_fullname, "content": doc.reply, - "batch_link": "/batches/" + topic.reference_docname + "#discussions", + "link": link, } for recipient in recipients: diff --git a/lms/templates/emails/mention_template.html b/lms/templates/emails/mention_template.html index ed0ecc4b..f791df47 100644 --- a/lms/templates/emails/mention_template.html +++ b/lms/templates/emails/mention_template.html @@ -7,5 +7,5 @@

- {{ _("Open Batch") }} + {{ _("Check Discussion") }}
\ No newline at end of file diff --git a/lms/templates/quiz/quiz.html b/lms/templates/quiz/quiz.html index 84caaf50..ccbdc9d1 100644 --- a/lms/templates/quiz/quiz.html +++ b/lms/templates/quiz/quiz.html @@ -10,9 +10,6 @@
  • {{ _("You will have to get {0}% correct answers in order to pass the quiz.").format(quiz.passing_percentage) }}
  • -
  • - {{ _("Without passing the quiz you won't be able to complete the lesson.") }} -
  • {% endif %} {% if quiz.max_attempts %} diff --git a/lms/templates/quiz/quiz.js b/lms/templates/quiz/quiz.js index ed37a030..186ba447 100644 --- a/lms/templates/quiz/quiz.js +++ b/lms/templates/quiz/quiz.js @@ -134,6 +134,9 @@ const quiz_summary = (e = undefined) => { $(".quiz-footer span").addClass("hide"); $("#quiz-form").prepend( `
    + ${__("You got")} ${data.message.percentage}% ${__("correct answers")} +
    +
    ${__("Your score is")} ${data.message.score} ${__("out of")} ${data.message.score_out_of}
    ` diff --git a/lms/www/quiz_submission/quiz_submission.py b/lms/www/quiz_submission/quiz_submission.py index f7d3f35b..6f6292c4 100644 --- a/lms/www/quiz_submission/quiz_submission.py +++ b/lms/www/quiz_submission/quiz_submission.py @@ -13,7 +13,39 @@ def get_context(context): submission = frappe.form_dict["submission"] quiz_name = frappe.form_dict["quiz"] - context.quiz = frappe.get_doc("LMS Quiz", quiz_name) + quiz = frappe.db.get_value( + "LMS Quiz", + quiz_name, + [ + "name", + "title", + "max_attempts", + "show_answers", + "show_submission_history", + "passing_percentage", + ], + as_dict=True, + ) + quiz.questions = [] + fields = ["name", "question", "type", "multiple"] + for num in range(1, 5): + fields.append(f"option_{num}") + fields.append(f"is_correct_{num}") + fields.append(f"explanation_{num}") + fields.append(f"possibility_{num}") + + questions = frappe.get_all( + "LMS Quiz Question", + filters={"parent": quiz.name}, + fields=["question", "marks"], + order_by="idx", + ) + + for question in questions: + details = frappe.db.get_value("LMS Question", question.question, fields, as_dict=1) + details["marks"] = question.marks + quiz.questions.append(details) + context.quiz = quiz if submission == "new-submission": context.submission = frappe._dict()