Commit f4c4e0569abf462232ea5ae550bb0a4ae51e4855

Authored by Austin Smith
1 parent 55a184bf61
Exists in master

remove unnecessary coalesce

Showing 1 changed file with 6 additions and 2 deletions Side-by-side Diff

app/controllers/my_taskboard_controller.rb View file @ f4c4e05
... ... @@ -44,9 +44,13 @@
44 44 def save
45 45 TaskBoardAssignee.destroy_all(:assignee_id => @user.id)
46 46 weight = 1;
  47 + used_ids = Array.new
47 48 params[:sort].each do |issue_id|
48   - TaskBoardAssignee.create(:issue_id => issue_id, :assignee_id => @user.id, :weight => weight)
49   - weight += 1
  49 + unless used_ids.include? issue_id
  50 + used_ids << issue_id
  51 + TaskBoardAssignee.create(:issue_id => issue_id, :assignee_id => @user.id, :weight => weight)
  52 + weight += 1
  53 + end
50 54 end
51 55 respond_to do |format|
52 56 format.js{ head :ok }