|
|
@ -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
|
|
|
@ -641,7 +642,7 @@ module ExercisesHelper
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if student_status == 2 #当前为老师,或为学生且已提交
|
|
|
|
if student_status == 2 #当前为老师,或为学生且已提交
|
|
|
|
user_score_pre = exercise_answers.score_reviewed
|
|
|
|
user_score_pre = exercise_answers.score_reviewed
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil
|
|
|
|
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if user_score.present? && (user_score > q.question_score)
|
|
|
|
if user_score.present? && (user_score > q.question_score)
|
|
|
|