diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index c0bde5e4..5b68c433 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -153,7 +153,7 @@ class CompetitionTeamsController < ApplicationController # 新增加的成员 ids = new_member_ids - team_member_ids - raise @message unless check_member_enroll_limited?(@competition, ids) # 有成员已经加入其他战队,并且只能一次报名 + raise @message unless check_member_enroll_limited?(@competition, ids - [@team.user_id]) # 有成员已经加入其他战队,并且只能一次报名; 减去创建者 ids.each do |user_id| next if user_id.to_i == @team.user_id @@ -170,7 +170,7 @@ class CompetitionTeamsController < ApplicationController # 新增加的老师 ids = new_teacher_ids - teacher_ids - raise @message unless check_teacher_enroll_limited?(@competition, ids) # 有老师已经加入其他战队,并且只能一次报名 + raise @message unless check_teacher_enroll_limited?(@competition, ids - [@team.user_id]) # 有老师已经加入其他战队,并且只能一次报名;减去创建者 ids.each do |user_id| next if user_id.to_i == @team.user_id