竞赛列表页的调整

dev_aliyun
cxt 5 years ago
parent 8ff645a78b
commit 0793702299

@ -1087,7 +1087,7 @@ end
@only_teacher = @competition.competition_staffs.count == 1 && @competition.competition_staffs.first.category == 'teacher' @only_teacher = @competition.competition_staffs.count == 1 && @competition.competition_staffs.first.category == 'teacher'
@team_members = @competition.team_members @team_members = @competition.team_members
@team_members = @team_members.where(is_teacher: false) unless @only_teacher # 只有老师报名时才显示老师,此时老师作为队员 @team_members = @team_members.where("team_members.is_teacher = 0") unless @only_teacher # 只有老师报名时才显示老师,此时老师作为队员
if params[:school] || params[:location] if params[:school] || params[:location]
school_ids = School.where("schools.name like '%#{params[:school]}%'").pluck(:id) school_ids = School.where("schools.name like '%#{params[:school]}%'").pluck(:id)

@ -4,8 +4,8 @@ class CompetitionTeam < ActiveRecord::Base
belongs_to :competition belongs_to :competition
has_many :team_members, :dependent => :destroy has_many :team_members, :dependent => :destroy
has_many :members, conditions: 'is_teacher = 0', class_name: 'TeamMember' has_many :members, conditions: 'team_members.is_teacher = 0', class_name: 'TeamMember'
has_many :teachers, conditions: 'is_teacher = 1', class_name: 'TeamMember' has_many :teachers, conditions: 'team_members.is_teacher = 1', class_name: 'TeamMember'
has_many :competition_scores, :dependent => :destroy has_many :competition_scores, :dependent => :destroy
# team_type 0组队 1个人 # team_type 0组队 1个人
# attr_accessible :invite_code, :name, :team_type # attr_accessible :invite_code, :name, :team_type

Loading…
Cancel
Save