From d8ecd6e7728977f463a0975eaaef51640c5e7c9e Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Sat, 29 Jun 2019 15:09:44 +0800 Subject: [PATCH] =?UTF-8?q?tpi=20=E7=89=88=E6=9C=AC=E5=BA=93=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E6=9B=B4=E6=96=B0=E5=92=8C=E8=8E=B7=E5=8F=96=E7=9A=84?= =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/concerns/git_common.rb | 1 - app/controllers/concerns/git_helper.rb | 6 ++---- app/controllers/games_controller.rb | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/controllers/concerns/git_common.rb b/app/controllers/concerns/git_common.rb index 2f977245c..452204419 100644 --- a/app/controllers/concerns/git_common.rb +++ b/app/controllers/concerns/git_common.rb @@ -28,7 +28,6 @@ module GitCommon end def file_content - logger.info("#################{@repo_path}, #{@path}") @content = git_fle_content @repo_path, @path end diff --git a/app/controllers/concerns/git_helper.rb b/app/controllers/concerns/git_helper.rb index 78eae769c..8d769a244 100644 --- a/app/controllers/concerns/git_helper.rb +++ b/app/controllers/concerns/git_helper.rb @@ -9,11 +9,10 @@ module GitHelper # 版本库文件内容,带转码 def git_fle_content(repo_path, path) begin - logger.info("##########repo_path: #{repo_path}") - logger.info("##########path: #{path}") + logger.info("git file content: repo_path is #{repo_path}, path is #{path}") content = GitService.file_content(repo_path: repo_path, path: path) - logger.info("@@@@@@@@@@@@@@@@@@#{content}") + logger.info("git file content: content is #{content}") decode_content = nil if content.present? content = content["content"] #6.24 -hs 这个为新增,因为当实训题里含有选择题时,这里会报错,undefined method `[]' for nil:NilClass @@ -34,7 +33,6 @@ module GitHelper rescue Exception => e Rails.logger.error(e.message) - # uid_logger_error(e.message) raise Educoder::TipException.new("文档内容获取异常") end end diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index 8c364308f..2a2439226 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -461,6 +461,7 @@ class GamesController < ApplicationController git_fle_content(@myshixun.shixun.repo_path, path) rescue Exception => e uid_logger_error("#{e.message}") + # 如果已发布的TPM实训也不能获取到内容,那么肯定是版本库异常了 if @myshixun.shixun.try(:status) < 2 tip_exception("代码获取异常,请检查实训模板的评测设置是否正确") else