|
|
@ -245,6 +245,8 @@ class User < Principal
|
|
|
|
has_many :ec_major_schools, :through => :ec_major_school_users
|
|
|
|
has_many :ec_major_schools, :through => :ec_major_school_users
|
|
|
|
has_many :ec_major_school_users, :dependent => :destroy
|
|
|
|
has_many :ec_major_school_users, :dependent => :destroy
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
has_many :ec_course_users
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#####
|
|
|
|
#####
|
|
|
|
scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") }
|
|
|
|
scope :logged, lambda { where("#{User.table_name}.status <> #{STATUS_ANONYMOUS}") }
|
|
|
@ -344,6 +346,14 @@ class User < Principal
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# 工程认证的学校
|
|
|
|
|
|
|
|
def ec_school
|
|
|
|
|
|
|
|
school_id = self.ec_school_users.pluck(:school_id).first ||
|
|
|
|
|
|
|
|
self.ec_major_schools.pluck(:school_id).first ||
|
|
|
|
|
|
|
|
(self.ec_course_users.first && self.ec_course_users.first.try(:ec_course).try(:ec_year).try(:ec_major_school).try(:school_id))
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
def challenge_tags
|
|
|
|
def challenge_tags
|
|
|
|
games = self.games.where(:id => self.experiences.map(&:container_id), :status => 2)
|
|
|
|
games = self.games.where(:id => self.experiences.map(&:container_id), :status => 2)
|
|
|
|
challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id)).where("name != ''")
|
|
|
|
challenge_tags = ChallengeTag.where(:challenge_id => games.map(&:challenge_id)).where("name != ''")
|
|
|
|