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