Added batch start and end date validation
This commit is contained in:
@@ -23,6 +23,7 @@ class LMSBatch(Document):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
if self.seat_count:
|
if self.seat_count:
|
||||||
self.validate_seats_left()
|
self.validate_seats_left()
|
||||||
|
self.validate_batch_end_date():
|
||||||
self.validate_duplicate_courses()
|
self.validate_duplicate_courses()
|
||||||
self.validate_duplicate_students()
|
self.validate_duplicate_students()
|
||||||
self.validate_duplicate_assessments()
|
self.validate_duplicate_assessments()
|
||||||
@@ -31,6 +32,10 @@ class LMSBatch(Document):
|
|||||||
self.send_confirmation_mail()
|
self.send_confirmation_mail()
|
||||||
self.validate_evaluation_end_date()
|
self.validate_evaluation_end_date()
|
||||||
|
|
||||||
|
def validate_batch_end_date(self):
|
||||||
|
if(self.end_date<self.start_date):
|
||||||
|
frappe.throw("Batch end date cannot be before the batch start date")
|
||||||
|
|
||||||
def validate_duplicate_students(self):
|
def validate_duplicate_students(self):
|
||||||
students = [row.student for row in self.students]
|
students = [row.student for row in self.students]
|
||||||
duplicates = {student for student in students if students.count(student) > 1}
|
duplicates = {student for student in students if students.count(student) > 1}
|
||||||
|
|||||||
Reference in New Issue
Block a user