Skip to content

Commit

Permalink
Change assignment_participant file to import participants successfully.
Browse files Browse the repository at this point in the history
  • Loading branch information
Winbobob committed Sep 3, 2015
1 parent ac8f42c commit 45cb945
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/assignment_participant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def team

# provide import functionality for Assignment Participants
# if user does not exist, it will be created and added to this assignment
def self.import(row,session,id)
def self.import(row,row_header=nil,session,id)
raise ArgumentError, "No user id has been specified." if row.length < 1
user = User.find_by_name(row[0])
if user == nil
Expand All @@ -510,7 +510,7 @@ def self.import(row,session,id)
user = ImportFileHelper::create_new_user(attributes,session)
end
raise ImportError, "The assignment with id \""+id.to_s+"\" was not found." if Assignment.find(id) == nil
if all({conditions: ['user_id=? && parent_id=?', user.id, id]}).size == 0
if !AssignmentParticipant.exists?(:user_id => user.id, :parent_id => id)
new_part = AssignmentParticipant.create(:user_id => user.id, :parent_id => id)
new_part.set_handle()
end
Expand Down

0 comments on commit 45cb945

Please sign in to comment.