refactor: moved community member class functions to user override

This commit is contained in:
pateljannat
2021-05-21 16:22:59 +05:30
parent 63d00a46c4
commit 637c795321
13 changed files with 31 additions and 29 deletions

View File

@@ -31,3 +31,12 @@ class CustomUser(User):
idx = cint((int(hash_name[4:6], 16) + 1) / 5.33)
return palette[idx % 8]
def get_batch_count(self) -> int:
"""Returns the number of batches authored by this user.
"""
return frappe.db.count(
'LMS Batch Membership', {
'member': self.name,
'member_type': 'Mentor'
})