云上实验室

dev_forge
cxt 5 years ago
parent 2d29187d26
commit 44138bc460

@ -48,7 +48,8 @@ class Laboratory < ApplicationRecord
def shixuns def shixuns
if main_site? if main_site?
Shixun.where.not(id: laboratory_shixuns.pluck(:shixun_id)) not_shixun_ids = Shixun.joins(:laboratory_shixuns).where("laboratory_shixuns.laboratory_id != #{Laboratory.current.id}")
Shixun.where.not(id: not_shixun_ids.pluck(:shixun_id))
elsif sync_subject elsif sync_subject
laboratory_shixun_ids = laboratory_shixuns.pluck(:shixun_id) laboratory_shixun_ids = laboratory_shixuns.pluck(:shixun_id)
school_shixun_ids = Shixun.joins("join user_extensions on shixuns.user_id=user_extensions.user_id").where(user_extensions: { school_id: school_id }).pluck(:id) school_shixun_ids = Shixun.joins("join user_extensions on shixuns.user_id=user_extensions.user_id").where(user_extensions: { school_id: school_id }).pluck(:id)
@ -61,7 +62,8 @@ class Laboratory < ApplicationRecord
def subjects def subjects
if main_site? if main_site?
Subject.where.not(id: laboratory_subjects.pluck(:subject_id)) not_subject_ids = Subject.joins(:laboratory_subjects).where("laboratory_subjects.laboratory_id != #{Laboratory.current.id}")
Subject.where.not(id: not_subject_ids.pluck(:subject_id))
elsif sync_subject elsif sync_subject
laboratory_subject_ids = laboratory_subjects.pluck(:subject_id) laboratory_subject_ids = laboratory_subjects.pluck(:subject_id)
school_subject_ids = Subject.joins("join user_extensions on subjects.user_id=user_extensions.user_id").where(user_extensions: { school_id: school_id }).pluck(:id) school_subject_ids = Subject.joins("join user_extensions on subjects.user_id=user_extensions.user_id").where(user_extensions: { school_id: school_id }).pluck(:id)

Loading…
Cancel
Save