competition: fix form valid bug

dev_sync_trustie
p31729568 5 years ago
parent a6af66476b
commit 9871042d20

@ -73,10 +73,10 @@ class Competitions::SaveTeamForm
# 竞赛是否限制了职业
def check_creator_identity_enrollable
if user.is_teacher? && competition.teacher_enroll_forbidden?
if creator.is_teacher? && competition.teacher_enroll_forbidden?
errors.add(:creator, :teacher_enroll_forbidden)
return false
elsif !user.is_teacher? && competition.member_enroll_forbidden?
elsif !creator.is_teacher? && competition.member_enroll_forbidden?
errors.add(:creator, :member_enroll_forbidden)
return false
end
@ -86,9 +86,9 @@ class Competitions::SaveTeamForm
# 创建者是否能多次报名
def check_creator_multiple_enrollable
return unless competition.enrolled?(user)
return unless competition.enrolled?(creator)
if (user.is_teacher? && competition.teacher_multiple_limited?) || (!user.is_teacher? && competition.member_multiple_limited?)
if (creator.is_teacher? && competition.teacher_multiple_limited?) || (!creator.is_teacher? && competition.member_multiple_limited?)
errors.add(:creator, :enrolled)
return false
end

Loading…
Cancel
Save