feat: added image to exercise submission

This commit is contained in:
Anand Chitipothu
2021-05-21 13:10:54 +05:30
parent 632693c9f8
commit a2b856aaf8
2 changed files with 12 additions and 2 deletions

View File

@@ -43,6 +43,8 @@ class Exercise(Document):
course = frappe.get_doc("LMS Course", self.course) course = frappe.get_doc("LMS Course", self.course)
batch = course.get_student_batch(user) batch = course.get_student_batch(user)
image = livecode_to_svg(None, code)
doc = frappe.get_doc( doc = frappe.get_doc(
doctype="Exercise Submission", doctype="Exercise Submission",
exercise=self.name, exercise=self.name,
@@ -50,6 +52,7 @@ class Exercise(Document):
course=self.course, course=self.course,
lesson=self.lesson, lesson=self.lesson,
batch=batch and batch.name, batch=batch and batch.name,
image=image,
solution=code) solution=code)
doc.insert(ignore_permissions=True) doc.insert(ignore_permissions=True)
return doc return doc

View File

@@ -10,7 +10,8 @@
"exercise_title", "exercise_title",
"course", "course",
"batch", "batch",
"lesson" "lesson",
"image"
], ],
"fields": [ "fields": [
{ {
@@ -54,11 +55,17 @@
"fieldtype": "Link", "fieldtype": "Link",
"label": "Lesson", "label": "Lesson",
"options": "Lesson" "options": "Lesson"
},
{
"fieldname": "image",
"fieldtype": "Code",
"label": "Image",
"read_only": 1
} }
], ],
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"links": [], "links": [],
"modified": "2021-05-20 13:30:16.349278", "modified": "2021-05-21 11:28:45.833018",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "LMS", "module": "LMS",
"name": "Exercise Submission", "name": "Exercise Submission",