Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
daiao 5 years ago
commit 23ce69de1e

@ -429,11 +429,9 @@ module ExercisesHelper
answer_status = 1
end
ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id)
if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里
logger.info("############_________exercise_cha.challenge&.path___________###############{exercise_cha.challenge&.path}")
code = nil
if exercise_cha.challenge&.path.present?
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
if game_challenge.present?
game_code = game_challenge
@ -441,6 +439,9 @@ module ExercisesHelper
else
code = git_fle_content(game.myshixun.repo_path,cha_path)
end
end
if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里
### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了涉及到code的多个版本库的修改
sx_option = {
:exercise_question_id => q.id,
:exercise_shixun_challenge_id => exercise_cha.id,
@ -451,7 +452,7 @@ module ExercisesHelper
}
ExerciseShixunAnswer.create(sx_option)
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
score5 += exercise_cha_score
else
@ -641,7 +642,7 @@ module ExercisesHelper
end
if student_status == 2 #当前为老师,或为学生且已提交
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
if user_score.present? && (user_score > q.question_score)

@ -1,6 +1,10 @@
json.question_id question.id
# 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_type question.question_type
json.question_score question.question_score.round(1).to_s

@ -27,11 +27,14 @@ json.shixun_detail do
json.output_detail output_detail game, output
end
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)
else
latest_code = game.try(:lastest_code)
latest_code = nil
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)
else
latest_code = game.try(:lastest_code)
end
end
json.passed_code latest_code

@ -62,7 +62,7 @@ json.exercise_questions do
exercise_type: ex_type,
user_answer: user_ques_answers[:answered_content],
shixun_type: user_ques_answers[:shixun_type],
ques_position:nil
ques_position: nil
if user_ques_comments.count > 0
json.question_comments do
json.partial! "exercises/exercise_comments", question_comment:user_ques_answers[:question_comment].first

Loading…
Cancel
Save