From a521b361649adfde53874a5af6c8483d34f32baf Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 25 Jun 2019 11:09:38 +0800 Subject: [PATCH 1/2] fix bug --- config/initializers/pdfkit.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/initializers/pdfkit.rb b/config/initializers/pdfkit.rb index 8bd9e5e38..0cd80c9c7 100644 --- a/config/initializers/pdfkit.rb +++ b/config/initializers/pdfkit.rb @@ -1,6 +1,6 @@ PDFKit.configure do |config| - # config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || 'wkhtmltopdf' - config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || '/usr/bin/wkhtmltopdf' + config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || 'wkhtmltopdf' + # config.wkhtmltopdf = ENV["WKHTMLTOPDF_EXEC"] || '/usr/bin/wkhtmltopdf' config.default_options = { encoding: "UTF-8", page_size: 'A4', From dcec641b5b7f62410836152e2582db1acca66415 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 25 Jun 2019 11:33:02 +0800 Subject: [PATCH 2/2] fix bug --- app/helpers/exercises_helper.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 285dbb37e..9526acaf1 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -424,13 +424,13 @@ module ExercisesHelper end ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id) if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里 - cha_path = challenge_path exercise_cha.challenge.path - game_challenge = game.game_codes.search_challenge_path(cha_path).first + cha_path = challenge_path exercise_cha.challenge&.path + game_challenge = game.game_codes.search_challenge_path(cha_path)&.first if game_challenge.present? game_code = game_challenge code = game_code.try(:new_code) else - code = git_fle_content(exercise_cha.shixun.repo_path,cha_path) + code = git_fle_content(exercise_cha.shixun&.repo_path,cha_path) end sx_option = { :exercise_question_id => q.id,