Merge remote-tracking branch 'origin/develop' into develop

dev_home
杨树明 5 years ago
commit fdc0b2947e

@ -1,6 +1,6 @@
class ShixunListsController < ApplicationController
def index
@results = ShixunSearchService.call(search_params, request.subdomain)
@results = ShixunSearchService.call(search_params, current_laboratory)
end
private

@ -1,6 +1,6 @@
class SubjectListsController < ApplicationController
def index
@results = SubjectSearchService.call(search_params, request.subdomain)
@results = SubjectSearchService.call(search_params, current_laboratory)
end
private

@ -1,11 +1,11 @@
class ShixunSearchService < ApplicationService
include ElasticsearchAble
attr_reader :params, :subdomain
attr_reader :params, :laboratory
def initialize(params, subdomain)
def initialize(params, laboratory)
@params = params
@subdomain = subdomain
@laboratory = laboratory
end
def call
@ -37,8 +37,8 @@ class ShixunSearchService < ApplicationService
end
## 云上实验室过滤
unless current_laboratory.main_site?
@shixuns = @shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: current_laboratory.id })
unless laboratory.main_site?
@shixuns = @shixuns.joins(:laboratory_shixuns).where(laboratory_shixuns: { laboratory_id: @laboratory.id })
end
# laboratory = Laboratory.find_by_subdomain(subdomain)

@ -1,11 +1,11 @@
class SubjectSearchService < ApplicationService
include ElasticsearchAble
attr_reader :params, :subdomain
attr_reader :params, :laboratory
def initialize(params, subdomain)
def initialize(params, laboratory)
@params = params
@subdomain = subdomain
@laboratory = laboratory
end
def call
@ -22,8 +22,8 @@ class SubjectSearchService < ApplicationService
# @subjects = @subjects.where(id: laboratory.subjects) if laboratory
## 云上实验室过滤
unless current_laboratory.main_site?
subjects = subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: current_laboratory.id })
unless laboratory.main_site?
@subjects = @subjects.joins(:laboratory_subjects).where(laboratory_subjects: { laboratory_id: laboratory.id })
end
Subject.search(keyword, search_options)

Loading…
Cancel
Save