refactor: fixed the course page

This commit is contained in:
Anand Chitipothu
2021-05-06 06:47:09 +05:30
parent da902d23f7
commit dc5b637ada
11 changed files with 191 additions and 141 deletions

View File

@@ -14,12 +14,14 @@ def get_member_with_name(name):
def get_batch(code):
try:
return frappe.db.get_value("LMS Batch", {"code": code}, ["name", "description"], as_dict=True)
print("get_batch", code)
return frappe.db.get_value("LMS Batch", {"name": code}, ["name", "description"], as_dict=True)
except frappe.DoesNotExistError:
print("Error: notfound")
return
def is_member_of_batch(batch_code):
membership = frappe.get_all("LMS Batch Membership", {"batch": get_batch(batch_code).name, "member": get_member_with_email()})
membership = frappe.get_all("LMS Batch Membership", {"batch": batch_code, "member": get_member_with_email()})
if len(membership):
return True
return False
@@ -54,4 +56,4 @@ def get_batch_members(batch):
if membership.member_type == "Mentor":
member.is_mentor = True
members.append(member)
return members
return members