feat: improved the subgroup page load time

Using `get_cached_doc` instead of `get_doc` for loading students and
mentors.

Issue #271
This commit is contained in:
Anand Chitipothu
2021-12-04 23:03:58 +05:30
parent 52fd891370
commit 63c4f708c3

View File

@@ -47,7 +47,7 @@ class CohortSubgroup(Document):
def get_mentors(self):
emails = frappe.get_all("Cohort Mentor", filters={"subgroup": self.name}, fields=["email"], pluck='email')
return [frappe.get_doc("User", email) for email in emails]
return [frappe.get_cached_doc("User", email) for email in emails]
def get_students(self):
emails = frappe.get_all("LMS Batch Membership",
@@ -56,7 +56,7 @@ class CohortSubgroup(Document):
pluck='member',
page_length=1000)
return [frappe.get_doc("User", email) for email in emails]
return [frappe.get_cached_doc("User", email) for email in emails]
def is_mentor(self, email):
q = {