From ce09f273734dccbe3628c1efd7f6c118133bcbe4 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Thu, 31 Aug 2023 23:32:46 +0530 Subject: [PATCH] fix: assignment renderer --- lms/lms/utils.py | 1 + lms/plugins.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 5347c2e0..2829f5d6 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -313,6 +313,7 @@ def render_html(lesson): if lesson.question: assignment = "{{ Assignment('" + lesson.question + "-" + lesson.file_type + "') }}" text = text + assignment + return markdown_to_html(text) diff --git a/lms/plugins.py b/lms/plugins.py index bc763238..59dcd3ab 100644 --- a/lms/plugins.py +++ b/lms/plugins.py @@ -183,21 +183,20 @@ def video_renderer(src): ) -def assignment_renderer(name): - - """supported_types = { - "Document": ".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "PDF": ".pdf", - "Image": ".png, .jpg, .jpeg", - "Video": "video/*", +def assignment_renderer(detail): + supported_types = { + "Document": ".doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "PDF": ".pdf", + "Image": ".png, .jpg, .jpeg", + "Video": "video/*", } question = detail.split("-")[0] file_type = detail.split("-")[1] accept = supported_types[file_type] if file_type else "" return frappe.render_template( - "templates/assignment.html", - {"question": question, "accept": accept, "file_type": file_type}, - )""" + "templates/assignment.html", + {"question": question, "accept": accept, "file_type": file_type}, + ) def show_custom_signup():