dev_forum
SylorHuang 6 years ago
parent 538efef33a
commit 9d7d609bb5

@ -429,11 +429,9 @@ module ExercisesHelper
answer_status = 1 answer_status = 1
end end
ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id) ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id)
if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里 code = nil
logger.info("############_________exercise_cha.challenge&.path___________###############{exercise_cha.challenge&.path}") if exercise_cha.challenge&.path.present?
cha_path = challenge_path(exercise_cha.challenge&.path) cha_path = challenge_path(exercise_cha.challenge&.path)
logger.info("############_________cha_path___________###############{cha_path}")
game_challenge = game.game_codes.search_challenge_path(cha_path)&.first game_challenge = game.game_codes.search_challenge_path(cha_path)&.first
if game_challenge.present? if game_challenge.present?
game_code = game_challenge game_code = game_challenge
@ -441,6 +439,9 @@ module ExercisesHelper
else else
code = git_fle_content(game.myshixun.repo_path,cha_path) code = git_fle_content(game.myshixun.repo_path,cha_path)
end end
end
if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里
### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了涉及到code的多个版本库的修改
sx_option = { sx_option = {
:exercise_question_id => q.id, :exercise_question_id => q.id,
:exercise_shixun_challenge_id => exercise_cha.id, :exercise_shixun_challenge_id => exercise_cha.id,
@ -451,7 +452,7 @@ module ExercisesHelper
} }
ExerciseShixunAnswer.create(sx_option) ExerciseShixunAnswer.create(sx_option)
else else
ex_shixun_answer_content.first.update_column('score',exercise_cha_score) ex_shixun_answer_content.first.update_attributes(score:exercise_cha_score.round(1),answer_text:code)
end end
score5 += exercise_cha_score score5 += exercise_cha_score
else else

@ -1,6 +1,10 @@
json.question_id question.id json.question_id question.id
# json.question_number question.question_number # json.question_number question.question_number
json.q_position ques_position.present? ? ques_position : question.question_number q_positon = question.question_number
if ques_position.present?
q_positon = ques_position
end
json.q_position q_positon
json.question_title question.question_title json.question_title question.question_title
json.question_type question.question_type json.question_type question.question_type
json.question_score question.question_score.round(1).to_s json.question_score question.question_score.round(1).to_s

@ -27,12 +27,15 @@ json.shixun_detail do
json.output_detail output_detail game, output json.output_detail output_detail game, output
end end
latest_code = nil
if shixun_challenge.challenge&.path.present?
if game.try(:lastest_code).blank? if game.try(:lastest_code).blank?
cha_path = challenge_path(shixun_challenge.challenge&.path) cha_path = challenge_path(shixun_challenge.challenge&.path)
latest_code = git_fle_content(game.myshixun.repo_path,cha_path) latest_code = git_fle_content(game.myshixun.repo_path,cha_path)
else else
latest_code = game.try(:lastest_code) latest_code = game.try(:lastest_code)
end end
end
json.passed_code latest_code json.passed_code latest_code
end end

Loading…
Cancel
Save