dev_shixuns
cxt 6 years ago
parent 4fe0bdb620
commit 14ef994d84

@ -316,9 +316,12 @@ class ChallengesController < ApplicationController
script = modify_shixun_script @shixun, @shixun.evaluate_script script = modify_shixun_script @shixun, @shixun.evaluate_script
@shixun.update_column(:evaluate_script, script) @shixun.update_column(:evaluate_script, script)
end end
if path != params[:challenge][:path]
shixun_modify_status_without_publish(@shixun, 1) # 学员任务文件路径更新不需要重置
end # if path != params[:challenge][:path]
# shixun_modify_status_without_publish(@shixun, 1)
# end
Attachment.attach_files(@challenge, params[:attachments]) Attachment.attach_files(@challenge, params[:attachments])
elsif params[:tab].to_i == 5 elsif params[:tab].to_i == 5
@challenge_tags.delete_all unless @challenge_tags.blank? @challenge_tags.delete_all unless @challenge_tags.blank?

@ -828,31 +828,30 @@ class ManagementsController < ApplicationController
@pod_num = res['sum'] @pod_num = res['sum']
@pod_dis = JSON.parse(res['distr']) if res['distr'].present? @pod_dis = JSON.parse(res['distr']) if res['distr'].present?
end end
@search = params[:search] # 搜索字
@keyword = params[:keyword].blank? ? "u_name" : params[:keyword] # 根据姓名/课程名搜索 page = (params['page'] || 1).to_i
if "u_name" == @keyword search = params[:search]
if @search.blank? keyword = params[:keyword]
@evaluate_recods = EvaluateRecord.where("0=0") limit = 20
else
user_id = User.where("concat(lastname, firstname) like '%#{@search}%'") if search
if "u_name" == keyword
@evaluate_recods = EvaluateRecord.joins("join users u on evaluate_records.user_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'") @evaluate_recods = EvaluateRecord.joins("join users u on evaluate_records.user_id = u.id").where("concat(u.lastname, u.firstname) like '%#{@search}%'")
# @evaluate_recods = EvaluateRecord.where(user_id: User.where("concat(lastname, firstname) like '%#{search}%'").pluck(:id))
else
@evaluate_recods = EvaluateRecord.joins("join user_extensions ue on evaluate_records.user_id = ue.user_id").where("ue.school_id in (select id from schools where name like '%#{@search}%')")
# @evaluate_recods = EvaluateRecord.where(user_id: UserExtensions.where(school_id: School.where("name like '%#{search}%'").pluck(:id)).pluck(:user_id))
end end
else else
school_id = School.where("name like '%#{@search}%'").map(&:id) @evaluate_recods = EvaluateRecord.all
user_id = UserExtensions.where(:school_id => school_id).map(&:user_id)
@evaluate_recods = EvaluateRecord.where(:user_id => user_id)
end end
@evaluate_recods_count = @evaluate_recods.count @evaluate_recods_count = @evaluate_recods.count
@page = (params['page'] || 1).to_i @evaluate_recods_pages = Paginator.new @evaluate_recods_count, limit, page
@limit = 20 @evaluate_recods = @evaluate_recods.includes(:shixun, :user).page(page).per(limit)
@is_remote = true
@evaluate_recods_pages = Paginator.new @evaluate_recods_count, @limit, @page
@offset ||= @evaluate_recods_pages.offset
@evaluate_recods = paginateHelper @evaluate_recods, @limit
respond_to do |format| respond_to do |format|
format.js format.js
format.html format.html
end end
end end

@ -0,0 +1,8 @@
class AddIndexOnEvaluateRecords < ActiveRecord::Migration
def up
add_index :evaluate_records, :user_id
end
def down
end
end
Loading…
Cancel
Save