feat: max attempts fields
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
"end_time",
|
"end_time",
|
||||||
"column_break_5",
|
"column_break_5",
|
||||||
"rating",
|
"rating",
|
||||||
|
"status",
|
||||||
"summary"
|
"summary"
|
||||||
],
|
],
|
||||||
"fields": [
|
"fields": [
|
||||||
@@ -75,11 +76,17 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "Member Name",
|
"label": "Member Name",
|
||||||
"read_only": 1
|
"read_only": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "status",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Status",
|
||||||
|
"options": "Pass\nFail"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2022-04-06 11:44:17.051279",
|
"modified": "2022-04-25 12:14:28.262851",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Certificate Evaluation",
|
"name": "LMS Certificate Evaluation",
|
||||||
|
|||||||
@@ -35,9 +35,12 @@
|
|||||||
"certification_section",
|
"certification_section",
|
||||||
"enable_certification",
|
"enable_certification",
|
||||||
"expiry",
|
"expiry",
|
||||||
"column_break_22",
|
"section_break_22",
|
||||||
"grant_certificate_after",
|
"grant_certificate_after",
|
||||||
"evaluator",
|
"evaluator",
|
||||||
|
"column_break_22",
|
||||||
|
"max_attempts",
|
||||||
|
"reapplication",
|
||||||
"pricing_section",
|
"pricing_section",
|
||||||
"paid_certificate",
|
"paid_certificate",
|
||||||
"currency",
|
"currency",
|
||||||
@@ -212,6 +215,24 @@
|
|||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Currency",
|
"label": "Currency",
|
||||||
"options": "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",
|
"is_published_field": "published",
|
||||||
@@ -237,7 +258,7 @@
|
|||||||
"link_fieldname": "course"
|
"link_fieldname": "course"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2022-04-08 14:36:22.254656",
|
"modified": "2022-04-25 17:47:23.648958",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "LMS",
|
"module": "LMS",
|
||||||
"name": "LMS Course",
|
"name": "LMS Course",
|
||||||
|
|||||||
@@ -12,8 +12,9 @@ def get_context(context):
|
|||||||
raise frappe.Redirect
|
raise frappe.Redirect
|
||||||
|
|
||||||
course = frappe.db.get_value("LMS Course", course_name,
|
course = frappe.db.get_value("LMS Course", course_name,
|
||||||
["name", "title", "image", "short_introduction", "description", "published", "upcoming", "disable_self_learning", "status",
|
["name", "title", "image", "short_introduction", "description", "published", "upcoming", "disable_self_learning",
|
||||||
"video_link", "enable_certification", "grant_certificate_after", "paid_certificate", "price_certificate", "currency"],
|
"status", "video_link", "enable_certification", "grant_certificate_after", "paid_certificate",
|
||||||
|
"price_certificate", "currency", "max_attempts", "reapplication"],
|
||||||
as_dict=True)
|
as_dict=True)
|
||||||
|
|
||||||
if course is None:
|
if course is None:
|
||||||
@@ -33,14 +34,19 @@ def get_context(context):
|
|||||||
context.restriction = check_profile_restriction()
|
context.restriction = check_profile_restriction()
|
||||||
context.show_start_learing_cta = show_start_learing_cta(course, membership, context.restriction)
|
context.show_start_learing_cta = show_start_learing_cta(course, membership, context.restriction)
|
||||||
context.certificate = is_certified(course.name)
|
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,
|
"course": course.name,
|
||||||
"member": frappe.session.user
|
"member": frappe.session.user
|
||||||
},
|
}, ["date", "start_time", "end_time"],
|
||||||
["date", "start_time", "end_time"],
|
|
||||||
as_dict=True)
|
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:
|
if context.course.upcoming:
|
||||||
context.is_user_interested = get_user_interest(context.course.name)
|
context.is_user_interested = get_user_interest(context.course.name)
|
||||||
|
|
||||||
@@ -52,11 +58,10 @@ def get_context(context):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def get_user_interest(course):
|
def get_user_interest(course):
|
||||||
return frappe.db.count("LMS Course Interest",
|
return frappe.db.count("LMS Course Interest", {
|
||||||
{
|
"course": course,
|
||||||
"course": course,
|
"user": frappe.session.user
|
||||||
"user": frappe.session.user
|
})
|
||||||
})
|
|
||||||
|
|
||||||
def show_start_learing_cta(course, membership, restriction):
|
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)
|
return not course.disable_self_learning and not membership and not course.upcoming and not restriction.get("restrict") and not is_instructor(course.name)
|
||||||
|
|||||||
Reference in New Issue
Block a user