diff --git a/src/app/common/services/unit-service.coffee b/src/app/common/services/unit-service.coffee index cfb4ee123..aa2e345d1 100644 --- a/src/app/common/services/unit-service.coffee +++ b/src/app/common/services/unit-service.coffee @@ -96,7 +96,12 @@ angular.module("doubtfire.common.services.units", []) unit.addStudent = (student) -> analyticsService.event 'Unit Service', 'Added Student' unit.extendStudent(student) - unit.students.push(student) + if not unit.students[unit.students.indexOf(unit.findStudent(student.project_id))]? + #handles adding a newly enrolled student tutor view student list with enrol modal + unit.students.push(student) + else + #handles not adding a new entry to the student list in the convenor view with enrol modal + unit.students[unit.students.indexOf(unit.findStudent(student.project_id))] = student unit.active_students = () -> _.filter unit.students, (student) -> student.enrolled