dev_course
SylorHuang 6 years ago
parent f4503cc467
commit 8fce13d83a

@ -20,6 +20,7 @@ class ZipsController < ApplicationController
exercises = ExportExercisesService.new(@exercise,@ex_users) exercises = ExportExercisesService.new(@exercise,@ex_users)
file_name = filename_for_content_disposition(exercises.filename) file_name = filename_for_content_disposition(exercises.filename)
logger.info("##################_______________________file_name_____________________############{file_name}")
send_file exercises.ex_zip, filename: file_name, type: 'application/zip' send_file exercises.ex_zip, filename: file_name, type: 'application/zip'
rescue Exception => e rescue Exception => e
normal_status(-1, e.message) normal_status(-1, e.message)
@ -39,14 +40,14 @@ class ZipsController < ApplicationController
def get_exercise def get_exercise
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin
@exercise = Exercise.find_by(id:params[:exercise_id]) @exercise = Exercise.find_by(id:params[:exercise_id]).includes(:exercise_users)
group_id = params[:exercise_group_id] group_id = params[:exercise_group_id]
if @exercise.blank? if @exercise.blank?
normal_status(-1,"试卷不存在") normal_status(-1,"试卷不存在")
else else
@course = @exercise.course @course = @exercise.course.includes(:course_members)
default_ex_users = @exercise.all_exercise_users(current_user.id).exercise_user_committed.limit 2 default_ex_users = @exercise.all_exercise_users(current_user.id).exercise_user_committed
default_ex_users_size = default_ex_users.size default_ex_users_size = default_ex_users.size
@ex_users = default_ex_users #仅导出已提交的,截止后则是全部为提交的。 @ex_users = default_ex_users #仅导出已提交的,截止后则是全部为提交的。
#可以分班选择 #可以分班选择

@ -1,7 +1,8 @@
PDFKit.configure do |config| PDFKit.configure do |config|
# config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || 'wkhtmltopdf' config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || 'wkhtmltopdf'
config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || '/usr/bin/wkhtmltopdf' # config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || '/usr/bin/wkhtmltopdf'
config.default_options = { config.default_options = {
encoding: "UTF-8",
page_size: 'A4', page_size: 'A4',
print_media_type: true, print_media_type: true,
dpi: 300, dpi: 300,

Loading…
Cancel
Save