@ -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
@ -4098,7 +4097,7 @@ end
book = Spreadsheet :: Workbook . new
book = Spreadsheet :: Workbook . new
sheet1 = book . create_worksheet :name = > " 已发布实训课程 "
sheet1 = book . create_worksheet :name = > " 已发布实训课程 "
count_row = 2
count_row = 2
sheet1 . row ( 1 ) . concat ( [ " " , " 地址 " , " 实训课程名称 " , " 章节名称 " , " 实训组成 " , " 关卡数 " , " 状态 " , " 更新时间" ] )
sheet1 . row ( 1 ) . concat ( [ " " , " 地址 " , " 实训课程名称 " , " 章节名称 " , " 实训组成 " , " 关卡数 " , " 状态 " , " 课程等级" , " 更新时间" , " 发布时间 " , ] )
Rails . logger . warn ( " # # # # # # # # # # subjects: #{ subjects . count } " )
Rails . logger . warn ( " # # # # # # # # # # subjects: #{ subjects . count } " )
subjects . each do | subject |
subjects . each do | subject |
sheet1 [ count_row , 1 ] = " paths/ " + subject . id . to_s
sheet1 [ count_row , 1 ] = " paths/ " + subject . id . to_s
@ -4112,19 +4111,25 @@ end
sheet1 [ count_row , 5 ] = shixun . challenges . count
sheet1 [ count_row , 5 ] = shixun . challenges . count
sheet1 [ count_row , 6 ] = shixun . shixun_status
sheet1 [ count_row , 6 ] = shixun . shixun_status
if s_index == 0 && index == 0
if s_index == 0 && index == 0
sheet1 [ count_row , 7 ] = format_time subject . updated_at
sheet1 [ count_row , 7 ] = subject . subject_level_system . try ( :name ) || " -- "
sheet1 [ count_row , 8 ] = format_time subject . updated_at
sheet1 [ count_row , 9 ] = format_time subject . publish_time
end
end
count_row += 1
count_row += 1
end
end
else
else
if s_index == 0
if s_index == 0
sheet1 [ count_row , 7 ] = format_time subject . updated_at
sheet1 [ count_row , 7 ] = subject . subject_level_system . try ( :name ) || " -- "
sheet1 [ count_row , 8 ] = format_time subject . updated_at
sheet1 [ count_row , 9 ] = format_time subject . publish_time
end
end
count_row += 1
count_row += 1
end
end
end
end
else
else
sheet1 [ count_row , 7 ] = format_time subject . updated_at
sheet1 [ count_row , 7 ] = subject . subject_level_system . try ( :name ) || " -- "
sheet1 [ count_row , 8 ] = format_time subject . updated_at
sheet1 [ count_row , 9 ] = format_time subject . publish_time
count_row += 1
count_row += 1
end
end
end
end