Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
daiao 5 years ago
commit 3920568fc7

@ -1293,19 +1293,38 @@ class ExercisesController < ApplicationController
@exercise_users_list = @exercise_users_list.page(@page).per(@limit) @exercise_users_list = @exercise_users_list.page(@page).per(@limit)
respond_to do |format| respond_to do |format|
format.json format.json
if @user_course_identity > Course::ASSISTANT_PROFESSOR
tip_exception(403,"无权限操作")
elsif (@exercise_users_size == 0) || ( @export_ex_users&.exercise_user_committed.size == 0)
logger.info("#######___________@exercise_users_size_________##################{@exercise_users_size}")
logger.info("#######__________@export_ex_users&.exercise_user_committed.size_________##################{@export_ex_users&.exercise_user_committed.size}")
normal_status(-1,"暂无用户提交")
else
format.xlsx{
get_export_users(@exercise,@course,@export_ex_users)
exercise_export_name =
"#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
render xlsx: "#{exercise_export_name.strip.first(30)}",template: "exercises/exercise_lists.xlsx.axlsx",locals: {table_columns:@table_columns,exercise_users:@user_columns}
}
end
format.xlsx{ format.xlsx{
if @user_course_identity > Course::ASSISTANT_PROFESSOR # if @user_course_identity > Course::ASSISTANT_PROFESSOR
tip_exception(403,"无权限操作") # tip_exception(403,"无权限操作")
else # else
if @export_ex_users.exercise_user_committed.size == 0 # if (@exercise_users_size == 0) || ( @export_ex_users&.exercise_user_committed.size == 0)
normal_status(-1,"暂无用户提交") # logger.info("#######__________@export_ex_users&.exercise_user_committed.size_________##################{@export_ex_users&.exercise_user_committed.size}")
else # logger.info("#######___________@exercise_users_size_________##################{@exercise_users_size}")
get_export_users(@exercise,@course,@export_ex_users) #
exercise_export_name = # normal_status(-1,"暂无用户提交")
"#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}" # else
render xlsx: "#{exercise_export_name.strip.first(30)}",template: "exercises/exercise_lists.xlsx.axlsx",locals: {table_columns:@table_columns,exercise_users:@user_columns} # get_export_users(@exercise,@course,@export_ex_users)
end # exercise_export_name =
end # "#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
# render xlsx: "#{exercise_export_name.strip.first(30)}",template: "exercises/exercise_lists.xlsx.axlsx",locals: {table_columns:@table_columns,exercise_users:@user_columns}
# end
# end
} }
end end
else else
@ -1316,9 +1335,6 @@ class ExercisesController < ApplicationController
format.xlsx{ format.xlsx{
normal_status(-1,"暂无用户提交") normal_status(-1,"暂无用户提交")
} }
format.zip{
normal_status(-1,"暂无用户提交")
}
end end
end end

Loading…
Cancel
Save