-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a64b0f7
commit 0e6df83
Showing
7 changed files
with
107 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import frappe | ||
|
||
|
||
def execute(): | ||
set_question_data() | ||
set_submission_data() | ||
|
||
|
||
def set_question_data(): | ||
questions = frappe.get_all("LMS Quiz Question", fields=["name", "question"]) | ||
|
||
for question in questions: | ||
question_doc = frappe.db.get_value( | ||
"LMS Question", question.question, ["question", "type"], as_dict=1 | ||
) | ||
frappe.db.set_value( | ||
"LMS Quiz Question", | ||
question.name, | ||
{"question_detail": question_doc.question, "type": question_doc.type}, | ||
) | ||
|
||
|
||
def set_submission_data(): | ||
submissions = frappe.get_all("LMS Quiz Submission", fields=["name", "quiz"]) | ||
|
||
for submission in submissions: | ||
quiz_title = frappe.db.get_value("LMS Quiz", submission.quiz, "title") | ||
frappe.db.set_value("LMS Quiz Submission", submission.name, "quiz_title", quiz_title) | ||
|
||
questions = frappe.get_all( | ||
"LMS Quiz Result", filters={"parent": submission.name}, fields=["question_name"] | ||
) | ||
|
||
for question in questions: | ||
if question.question_name: | ||
marks_out_of = frappe.db.get_value( | ||
"LMS Quiz Question", | ||
{"parent": submission.quiz, "question": question.question_name}, | ||
["marks"], | ||
) | ||
|
||
frappe.db.set_value( | ||
"LMS Quiz Result", | ||
{"parent": submission.name, "question_name": question.question_name}, | ||
"marks_out_of", | ||
marks_out_of, | ||
) |