Skip to content

Commit

Permalink
FIX: Remove duplicate enrolled students in convenor view
Browse files Browse the repository at this point in the history
When using enrol modal in convenor view, enrolling a student would duplicate them in list of students
  • Loading branch information
Reuben Wilson authored and alexcu committed Mar 22, 2016
1 parent 4e81298 commit b54f5f5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/common/services/unit-service.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b54f5f5

Please sign in to comment.