diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 0b18ff6f8..f59bee5ac 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -484,7 +484,11 @@ module ExercisesHelper game_code = game_challenge code = game_code.try(:new_code) else - code = git_fle_content(game.myshixun.repo_path,cha_path) + begin + code = git_fle_content(game.myshixun.repo_path,cha_path) + rescue + code = "" + end end end if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里 diff --git a/app/views/exercises/_shixun_details.json.jbuilder b/app/views/exercises/_shixun_details.json.jbuilder index 29a39a594..bd559d37d 100644 --- a/app/views/exercises/_shixun_details.json.jbuilder +++ b/app/views/exercises/_shixun_details.json.jbuilder @@ -31,8 +31,9 @@ json.shixun_detail do if shixun_challenge.challenge&.path.present? if game.try(:lastest_code).blank? cha_path = challenge_path(shixun_challenge.challenge&.path) - latest_code = git_fle_content(game.myshixun.repo_path,cha_path) - if latest_code.to_s == "true" + begin + latest_code = git_fle_content(game.myshixun.repo_path,cha_path) + rescue latest_code = "" end else diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake index a7fac1a8f..4309eec26 100644 --- a/lib/tasks/excellent_course_exercise.rake +++ b/lib/tasks/excellent_course_exercise.rake @@ -149,7 +149,12 @@ namespace :excellent_course_exercise do game_code = game_challenge code = game_code.try(:new_code) else - code = git_fle_content(game.myshixun.repo_path,cha_path) + begin #8-23,hs + code = git_fle_content(game.myshixun.repo_path,cha_path) + rescue + code = "" + end + # code = git_fle_content(game.myshixun.repo_path,cha_path) end end if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里