Skip to content

Commit

Permalink
Merge pull request #711 from ph4ni/main
Browse files Browse the repository at this point in the history
Added batch start and end date validation
  • Loading branch information
pateljannat authored May 24, 2024
2 parents febf38a + 8e7c1da commit 97712db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lms/lms/doctype/lms_batch/lms_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class LMSBatch(Document):
def validate(self):
if self.seat_count:
self.validate_seats_left()
self.validate_batch_end_date()
self.validate_duplicate_courses()
self.validate_duplicate_students()
self.validate_duplicate_assessments()
Expand All @@ -31,6 +32,10 @@ def validate(self):
self.send_confirmation_mail()
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):
students = [row.student for row in self.students]
duplicates = {student for student in students if students.count(student) > 1}
Expand Down

0 comments on commit 97712db

Please sign in to comment.