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
@shixun.update_column(:evaluate_script, script)
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])
elsif params[:tab].to_i == 5
@challenge_tags.delete_all unless @challenge_tags.blank?

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