云上实验室的选用实训、选用实践课程

dev_home
cxt 5 years ago
parent 9adb713498
commit 9ffe3e896a

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

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

@ -1,10 +1,11 @@
class ShixunSearchService < ApplicationService
include ElasticsearchAble
attr_reader :params
attr_reader :params, :subdomain
def initialize(params)
def initialize(params, subdomain)
@params = params
@subdomain = subdomain
end
def call
@ -35,7 +36,7 @@ class ShixunSearchService < ApplicationService
@shixuns = @shixuns.where(trainee: params[:diff])
end
laboratory = Laboratory.find_by_subdomain(request.subdomain)
laboratory = Laboratory.find_by_subdomain(subdomain)
@shixuns = @shixuns.where(id: laboratory.shixuns) if laboratory
Shixun.search(keyword, search_options)

@ -1,10 +1,11 @@
class SubjectSearchService < ApplicationService
include ElasticsearchAble
attr_reader :params
attr_reader :params, :subdomain
def initialize(params)
def initialize(params, subdomain)
@params = params
@subdomain = subdomain
end
def call
@ -17,7 +18,7 @@ class SubjectSearchService < ApplicationService
@subjects = Subject.visible.unhidden
end
laboratory = Laboratory.find_by_subdomain(request.subdomain)
laboratory = Laboratory.find_by_subdomain(subdomain)
@subjects = @subjects.where(id: laboratory.subjects) if laboratory
Subject.search(keyword, search_options)

Loading…
Cancel
Save