fix: polished the course certification flow
This commit is contained in:
@@ -59,7 +59,6 @@ class CourseEvaluator(Document):
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_schedule(course, date, batch=None):
|
||||
print(batch)
|
||||
evaluator = get_evaluator(course, batch)
|
||||
day = datetime.strptime(date, "%Y-%m-%d").strftime("%A")
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class LMSCourse(Document):
|
||||
self.validate_video_link()
|
||||
self.validate_status()
|
||||
self.validate_payments_app()
|
||||
self.validate_evaluator()
|
||||
self.validate_certification()
|
||||
self.validate_amount_and_currency()
|
||||
self.image = validate_image(self.image)
|
||||
|
||||
@@ -52,7 +52,12 @@ class LMSCourse(Document):
|
||||
if "payments" not in installed_apps:
|
||||
frappe.throw(_("Please install the Payments app to create a paid courses."))
|
||||
|
||||
def validate_evaluator(self):
|
||||
def validate_certification(self):
|
||||
if self.enable_certification and self.paid_certificate:
|
||||
frappe.throw(
|
||||
_("A course cannot have both paid certificate and certificate of completion.")
|
||||
)
|
||||
|
||||
if self.paid_certificate and not self.evaluator:
|
||||
frappe.throw(_("Evaluator is required for paid certificates."))
|
||||
|
||||
|
||||
@@ -869,15 +869,20 @@ def get_evaluator(course, batch=None):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_upcoming_evals(student, courses):
|
||||
def get_upcoming_evals(student, courses, batch=None):
|
||||
filters = {
|
||||
"member": student,
|
||||
"course": ["in", courses],
|
||||
"date": [">=", frappe.utils.nowdate()],
|
||||
"status": "Upcoming",
|
||||
}
|
||||
|
||||
if batch:
|
||||
filters["batch_name"] = batch
|
||||
|
||||
upcoming_evals = frappe.get_all(
|
||||
"LMS Certificate Request",
|
||||
{
|
||||
"member": student,
|
||||
"course": ["in", courses],
|
||||
"date": [">=", frappe.utils.nowdate()],
|
||||
"status": "Upcoming",
|
||||
},
|
||||
filters,
|
||||
[
|
||||
"name",
|
||||
"date",
|
||||
|
||||
Reference in New Issue
Block a user