mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 03:39:11 +00:00
feat: Added check for duplicate course enrollment
This commit is contained in:
@@ -20,4 +20,13 @@ class CourseEnrollment(Document):
|
|||||||
progress = []
|
progress = []
|
||||||
for topic in topics:
|
for topic in topics:
|
||||||
progress.append(student.get_topic_progress(self.name, topic))
|
progress.append(student.get_topic_progress(self.name, topic))
|
||||||
return reduce(lambda x,y: x+y, progress) # Flatten out the List
|
return reduce(lambda x,y: x+y, progress) # Flatten out the List
|
||||||
|
|
||||||
|
def validate_duplication(self):
|
||||||
|
enrollment = frappe.get_all("Course Enrollment", filters={
|
||||||
|
"student": self.student,
|
||||||
|
"course": self.course,
|
||||||
|
"program_enrollment": self.program_enrollment
|
||||||
|
})
|
||||||
|
if enrollment:
|
||||||
|
frappe.throw(_("Student is already enrolled."))
|
||||||
Reference in New Issue
Block a user