Merge pull request #482 from pateljannat/misc-fix

This commit is contained in:
Jannat Patel
2023-02-27 09:13:59 +05:30
committed by GitHub
4 changed files with 9 additions and 6 deletions

View File

@@ -58,4 +58,4 @@ def grade_assignment(name, result, comments):
doc = frappe.get_doc("Lesson Assignment", name)
doc.status = result
doc.comments = comments
doc.save()
doc.save(ignore_permissions=True)

View File

@@ -126,7 +126,7 @@ def save_quiz(quiz_title, questions, quiz):
}
)
question_doc.update({"question": row["question"]})
question_doc.update({"question": row["question"], "multiple": row["multiple"]})
for num in range(1, 5):
question_doc.update(

View File

@@ -1974,4 +1974,6 @@ select {
font-weight: 500;
}
.common-page-style .tooltip-content {
display: none;
}

View File

@@ -92,7 +92,7 @@ const get_questions = () => {
if (!$(el).find(".question").text()) return;
let details = {};
let one_correct_option = false;
let correct_options = 0;
details["question"] = $(el).find(".question").text();
details["question_name"] =
$(el).find(".question").data("question") || "";
@@ -111,7 +111,7 @@ const get_questions = () => {
.find(`.option-${num} .option-checkbox`)
.find("input")
.prop("checked");
if (is_correct) one_correct_option = true;
if (is_correct) correct_options += 1;
details[`is_correct_${num}`] = is_correct;
});
@@ -119,11 +119,12 @@ const get_questions = () => {
if (!details["option_1"] || !details["option_2"])
frappe.throw(__("Each question must have at least two options."));
if (!one_correct_option)
if (!correct_options)
frappe.throw(
__("Each question must have at least one correct option.")
);
details["multiple"] = correct_options > 1 ? 1 : 0;
questions.push(details);
});