diff --git a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json index e2413f9e..a7ae0fc6 100644 --- a/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json +++ b/lms/lms/doctype/lms_certificate_evaluation/lms_certificate_evaluation.json @@ -14,6 +14,7 @@ "end_time", "column_break_5", "rating", + "status", "summary" ], "fields": [ @@ -75,11 +76,17 @@ "fieldtype": "Data", "label": "Member Name", "read_only": 1 + }, + { + "fieldname": "status", + "fieldtype": "Select", + "label": "Status", + "options": "Pass\nFail" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-04-06 11:44:17.051279", + "modified": "2022-04-25 12:14:28.262851", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate Evaluation", diff --git a/lms/lms/doctype/lms_course/lms_course.json b/lms/lms/doctype/lms_course/lms_course.json index 8aa9b069..e0185d4d 100644 --- a/lms/lms/doctype/lms_course/lms_course.json +++ b/lms/lms/doctype/lms_course/lms_course.json @@ -35,9 +35,12 @@ "certification_section", "enable_certification", "expiry", - "column_break_22", + "section_break_22", "grant_certificate_after", "evaluator", + "column_break_22", + "max_attempts", + "reapplication", "pricing_section", "paid_certificate", "currency", @@ -212,6 +215,24 @@ "fieldtype": "Link", "label": "Currency", "options": "Currency" + }, + { + "default": "1", + "depends_on": "eval: doc.grant_certificate_after == \"Evaluation\"", + "fieldname": "max_attempts", + "fieldtype": "Int", + "label": "Max Number of Attempts for Evaluations" + }, + { + "depends_on": "eval: doc.grant_certificate_after == \"Evaluation\"", + "fieldname": "reapplication", + "fieldtype": "Select", + "label": "Re-application After (Months)", + "options": "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12" + }, + { + "fieldname": "section_break_22", + "fieldtype": "Section Break" } ], "is_published_field": "published", @@ -237,7 +258,7 @@ "link_fieldname": "course" } ], - "modified": "2022-04-08 14:36:22.254656", + "modified": "2022-04-25 17:47:23.648958", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course", diff --git a/lms/www/courses/course.py b/lms/www/courses/course.py index 23598ba1..b528e8ea 100644 --- a/lms/www/courses/course.py +++ b/lms/www/courses/course.py @@ -12,8 +12,9 @@ def get_context(context): raise frappe.Redirect course = frappe.db.get_value("LMS Course", course_name, - ["name", "title", "image", "short_introduction", "description", "published", "upcoming", "disable_self_learning", "status", - "video_link", "enable_certification", "grant_certificate_after", "paid_certificate", "price_certificate", "currency"], + ["name", "title", "image", "short_introduction", "description", "published", "upcoming", "disable_self_learning", + "status", "video_link", "enable_certification", "grant_certificate_after", "paid_certificate", + "price_certificate", "currency", "max_attempts", "reapplication"], as_dict=True) if course is None: @@ -33,14 +34,19 @@ def get_context(context): context.restriction = check_profile_restriction() context.show_start_learing_cta = show_start_learing_cta(course, membership, context.restriction) context.certificate = is_certified(course.name) - context.certificate_request = frappe.db.get_value("LMS Certificate Request", - { + context.certificate_request = frappe.db.get_value("LMS Certificate Request", { "course": course.name, "member": frappe.session.user - }, - ["date", "start_time", "end_time"], + }, ["date", "start_time", "end_time"], as_dict=True) + context.no_of_attempts = frappe.db.count("LMS Certificate Evaluation", { + "course": course.name, + "member": frappe.session.user, + "status" != "Pass", + "creation": [">=", add_days()] + }) + if context.course.upcoming: context.is_user_interested = get_user_interest(context.course.name) @@ -52,11 +58,10 @@ def get_context(context): } def get_user_interest(course): - return frappe.db.count("LMS Course Interest", - { - "course": course, - "user": frappe.session.user - }) + return frappe.db.count("LMS Course Interest", { + "course": course, + "user": frappe.session.user + }) def show_start_learing_cta(course, membership, restriction): return not course.disable_self_learning and not membership and not course.upcoming and not restriction.get("restrict") and not is_instructor(course.name)