fix: student max gropu cannot be zero or less than zero

This commit is contained in:
Khushal Trivedi 2020-02-18 19:37:21 +05:30
parent 3a196b09ee
commit 8773dc3ffe

View File

@ -26,8 +26,8 @@ class StudentGroup(Document):
frappe.throw(_("Please select Program"))
def validate_strength(self):
if self.max_strength < 0:
frappe.throw(_("""Cannot enroll less than 0 students for this student group."""))
if self.max_strength <= 0:
frappe.throw(_("""Cannot enroll less than or equal to 0 students for this student group."""))
if self.max_strength and len(self.students) > self.max_strength:
frappe.throw(_("""Cannot enroll more than {0} students for this student group.""").format(self.max_strength))