laboratory: main site not show second site data

dev_home
p31729568 5 years ago
parent 6962b0f64f
commit f4f85c36f0

@ -185,7 +185,6 @@ class Competition < ApplicationRecord
def set_laboratory
return unless new_record?
return if Laboratory.current.blank? || Laboratory.current.main_site?
self.laboratory = Laboratory.current
end

@ -415,7 +415,6 @@ class Course < ApplicationRecord
def set_laboratory
return unless new_record? # 新记录才需要标记
return if Laboratory.current.blank? || Laboratory.current.main_site?
self.laboratory = Laboratory.current
end

@ -11,6 +11,9 @@ class Laboratory < ApplicationRecord
has_many :laboratory_shixuns, dependent: :destroy
has_many :laboratory_subjects, dependent: :destroy
has_many :courses, dependent: :destroy
has_many :competitions, dependent: :destroy
validates :identifier, uniqueness: { case_sensitive: false }, allow_nil: true
delegate :name, :navbar, :footer, :login_logo_url, :nav_logo_url, :tab_logo_url, :default_navbar, to: :laboratory_setting
@ -47,14 +50,6 @@ class Laboratory < ApplicationRecord
main_site? ? Subject.all : Subject.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: id })
end
def courses
main_site? ? Course.all : Course.where(laboratory_id: self.id)
end
def competitions
main_site? ? Competition.all : Competition.where(laboratory_id: self.id)
end
def shixun_repertoires
where_sql = ShixunTagRepertoire.where("shixun_tag_repertoires.tag_repertoire_id = tag_repertoires.id")

Loading…
Cancel
Save