Merge pull request #125 from fossunited/hotfix-exercise-image

fix: fixed error on saving exercises
This commit is contained in:
Anand Chitipothu
2021-06-12 21:42:27 +05:30
committed by GitHub

View File

@@ -3,12 +3,9 @@
import frappe
from frappe.model.document import Document
from ..lms_sketch.livecode import livecode_to_svg
# from ..lms_sketch.livecode import livecode_to_svg
class Exercise(Document):
def before_save(self):
self.image = livecode_to_svg(None, self.answer)
def get_user_submission(self):
"""Returns the latest submission for this user.
"""
@@ -42,8 +39,6 @@ class Exercise(Document):
course = frappe.get_doc("LMS Course", self.course)
batch = course.get_student_batch(user)
image = livecode_to_svg(None, code)
doc = frappe.get_doc(
doctype="Exercise Submission",
exercise=self.name,
@@ -51,7 +46,6 @@ class Exercise(Document):
course=self.course,
lesson=self.lesson,
batch=batch and batch.name,
image=image,
solution=code)
doc.insert(ignore_permissions=True)