From 8709ae7113f6748365838cdacee9ef6dbcaa53ff Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 11 Oct 2022 09:53:21 +0530 Subject: [PATCH] fix: quiz submission --- .../lms_quiz_submission.json | 20 ++- lms/public/css/style.css | 9 +- lms/templates/quiz.html | 141 +++++++++++------- lms/www/batch/learn.html | 16 +- lms/www/batch/learn.js | 16 +- 5 files changed, 127 insertions(+), 75 deletions(-) diff --git a/lms/lms/doctype/lms_quiz_submission/lms_quiz_submission.json b/lms/lms/doctype/lms_quiz_submission/lms_quiz_submission.json index 887e115d..a2b13222 100644 --- a/lms/lms/doctype/lms_quiz_submission/lms_quiz_submission.json +++ b/lms/lms/doctype/lms_quiz_submission/lms_quiz_submission.json @@ -6,8 +6,11 @@ "engine": "InnoDB", "field_order": [ "member", + "member_name", + "column_break_3", "quiz", "score", + "section_break_6", "result" ], "fields": [ @@ -38,12 +41,26 @@ "in_standard_filter": 1, "label": "Member", "options": "User" + }, + { + "fetch_from": "member.full_name", + "fieldname": "member_name", + "fieldtype": "Data", + "label": "Member Name" + }, + { + "fieldname": "column_break_3", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_6", + "fieldtype": "Section Break" } ], "in_create": 1, "index_web_pages_for_search": 1, "links": [], - "modified": "2022-06-20 10:13:23.013802", + "modified": "2022-10-10 18:57:42.813738", "modified_by": "Administrator", "module": "LMS", "name": "LMS Quiz Submission", @@ -65,5 +82,6 @@ "sort_field": "modified", "sort_order": "DESC", "states": [], + "title_field": "member_name", "track_changes": 1 } \ No newline at end of file diff --git a/lms/public/css/style.css b/lms/public/css/style.css index 617b5a8a..395f1f19 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -573,7 +573,7 @@ input[type=checkbox] { } .lesson-content-card { - margin: 2rem 0 3rem; + margin-top: 2rem; } .lesson-content-card .alert-dismissible .close { @@ -599,9 +599,10 @@ input[type=checkbox] { } .lesson-pagination { - display: flex; - justify-content: space-between; - align-items: center; + display: flex; + justify-content: space-between; + align-items: center; + margin-top: 2rem } .lesson-pagination-parent { diff --git a/lms/templates/quiz.html b/lms/templates/quiz.html index 83b67185..da378cee 100644 --- a/lms/templates/quiz.html +++ b/lms/templates/quiz.html @@ -1,80 +1,105 @@ {% if attempts_exceeded %} -
+
{{ quiz.title }}
-
{{ _("You have already exceeded the maximum number of attempts allowed for this quiz.") }}
-
{{ _("Your latest score is {0}.").format(last_attempt_score) }}
+
+ {{ _("You have already exceeded the maximum number of attempts allowed for this quiz.") }} + {{ _("Your latest score is {0}.").format(last_attempt_score) }} +
+ + {% else %} -
{{ quiz.title }}
+
+ {{ quiz.title }} +
-
-
{{ quiz.title }}
-
{{ _("There are {0} questions in this quiz.").format(quiz.questions | length) }}{% if quiz.max_attempts %} - {% set suffix = "times" if quiz.max_attempts > 1 else "time" %} {{ _("This quiz can only be taken {0} {1}. If you attempt the quiz and leave the page before submitting, the quiz will be automatically submitted.").format(quiz.max_attempts, suffix) }}{% endif %} - {% if quiz.time %}{{ _("The quiz has a time limit. Each question will be given {0} seconds.").format(quiz.time) }}{% endif %} +
+
{{ quiz.title }}
+
+ {{ _("This quiz consists of {0} questions.").format(quiz.questions | length) }} + {% if quiz.max_attempts %} + {% set suffix = "times" if quiz.max_attempts > 1 else "time" %} + {{ _("This quiz can only be taken {0} {1}. If you attempt the quiz but leave the page before submitting, + the quiz will be automatically submitted.").format(quiz.max_attempts, suffix) }} + {% endif %} + {% if quiz.time %} + {{ _("The quiz has a time limit. For each question you will be given {0} seconds.").format(quiz.time) }} + {% endif %}
-
-
-
- {% for question in quiz.questions %} - {% set instruction = _("Choose all answers that apply") if question.multiple else _("Choose 1 answer") %} -
-
-
{{ loop.index }}.
-
- {{ frappe.utils.md_to_html(question.question) }} + +
+ {% for question in quiz.questions %} + {% set instruction = _("Choose all answers that apply") if question.multiple else _("Choose 1 answer") %} + +
+
+
{{ loop.index }}.
+
+ {{ frappe.utils.md_to_html(question.question) }} +
+
{{ instruction }}
-
{{ instruction }}
-
- {% set options = [question.option_1, question.option_2, question.option_3, question.option_4] %} - {% for option in options %} - {% if option %} -
-
- -
+ {% set options = [question.option_1, question.option_2, question.option_3, question.option_4] %} + {% for option in options %} + {% if option %} +
+
+ +
+ + {% set explanation = question['explanation_' + loop.index | string] %} + {% if explanation %} + {{ explanation }} + {% endif %} +
+ {% endif %} + {% endfor %} - {% set explanation = question['explanation_' + loop.index | string] %} - {% if explanation %} - {{ explanation }} - {% endif %}
- {% endif %} {% endfor %} +
-
- {% endfor %} -
+