fix competition enroll bug

dev_bj
p31729568 5 years ago
parent 46d0bf5ce7
commit a0feb16a6a

@ -153,7 +153,7 @@ class CompetitionTeamsController < ApplicationController
# 新增加的成员 # 新增加的成员
ids = new_member_ids - team_member_ids 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| ids.each do |user_id|
next if user_id.to_i == @team.user_id next if user_id.to_i == @team.user_id
@ -170,7 +170,7 @@ class CompetitionTeamsController < ApplicationController
# 新增加的老师 # 新增加的老师
ids = new_teacher_ids - teacher_ids 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| ids.each do |user_id|
next if user_id.to_i == @team.user_id next if user_id.to_i == @team.user_id

Loading…
Cancel
Save