From 684084cc6387dc56e2b9195bd7dbd8c69cf8572a Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 2 Jul 2019 09:02:43 +0800 Subject: [PATCH] fix bug --- app/controllers/exercises_controller.rb | 2 +- app/templates/exercise_export/blank_exercise.html.erb | 2 +- app/templates/exercise_export/exercise_user.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 3c364b979..aee99fbab 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1335,7 +1335,7 @@ class ExercisesController < ApplicationController def export_exercise @request_url = request.base_url @exercise_questions = @exercise.exercise_questions.includes(:exercise_choices).order("question_number ASC") - filename = "#{current_user.real_name}_#{@course.name}_#{@exercise.exercise_name}_#{Time.current.strftime('%Y%m%d%H%M%S')}.pdf" + filename = "#{@exercise.user.real_name}_#{@exercise.exercise_name}_#{Time.current.strftime('%Y%m%d%H%M%S')}.pdf" stylesheets = "#{Rails.root}/app/templates/exercise_export/exercise_export.css" render pdf: 'exercise_export/blank_exercise', filename: filename, stylesheets: stylesheets end diff --git a/app/templates/exercise_export/blank_exercise.html.erb b/app/templates/exercise_export/blank_exercise.html.erb index 37900d983..48bb1567f 100644 --- a/app/templates/exercise_export/blank_exercise.html.erb +++ b/app/templates/exercise_export/blank_exercise.html.erb @@ -19,7 +19,7 @@
-

+

<% if @exercise_single_ques_count > 0 %> 单选题<%= @exercise_single_ques_count %>题, diff --git a/app/templates/exercise_export/exercise_user.html.erb b/app/templates/exercise_export/exercise_user.html.erb index 9b2fef1e0..42d25dd1b 100644 --- a/app/templates/exercise_export/exercise_user.html.erb +++ b/app/templates/exercise_export/exercise_user.html.erb @@ -19,7 +19,7 @@

-

+

<% if @exercise_single_ques_count > 0 %> 单选题<%= @exercise_single_ques_count %>题,