dev_course
SylorHuang 5 years ago
parent 418077c59a
commit b3bda4ab65

@ -413,9 +413,8 @@ module ExercisesHelper
score2 += 0.0
end
elsif q.question_type == 5 #实训题时,主观题这里不评分
if answers_content.present?
q.exercise_shixun_challenges.each do |exercise_cha|
game = Game.user_games(user.id,exercise_cha.challenge_id).first #当前用户的关卡
game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡
if game.present?
exercise_cha_score = 0.0
answer_status = 0
@ -423,7 +422,7 @@ module ExercisesHelper
exercise_cha_score = exercise_cha.question_score #每一关卡的得分
answer_status = 1
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? #把关卡的答案存入试卷的实训里
cha_path = challenge_path exercise_cha.challenge.path
game_challenge = game.game_codes.search_challenge_path(cha_path).first
@ -446,12 +445,11 @@ module ExercisesHelper
ex_shixun_answer_content.first.update_column('score',exercise_cha_score)
end
score5 += exercise_cha_score
end
end
else
score5 += 0.0
end
end
end
user_scores = answers_content.present? ? answers_content.score_reviewed.pluck(:score).sum : 0.0
if user_scores > 0
stand_answer = 1

Loading…
Cancel
Save