|
|
|
@ -31,7 +31,8 @@ namespace :exercise_publish do
|
|
|
|
|
score2 = 0
|
|
|
|
|
score3 = 0
|
|
|
|
|
score4 = 0
|
|
|
|
|
exercise_qustions = exercise.exercise_questions
|
|
|
|
|
exercise_user = exercise.exercise_users.where(user_id: user.id).first
|
|
|
|
|
exercise_qustions = exercise.user_question_list(exercise_user.try(:id))
|
|
|
|
|
exercise_qustions.each do |question|
|
|
|
|
|
if question.question_type != 5
|
|
|
|
|
answer = question.exercise_answers.where("#{ExerciseAnswer.table_name}.user_id = #{user.id}")
|
|
|
|
@ -69,9 +70,9 @@ namespace :exercise_publish do
|
|
|
|
|
answer_status = 0
|
|
|
|
|
cha_path = exercise_cha.challenge.path.present? ? exercise_cha.challenge.path.split(";") : []
|
|
|
|
|
challeng_path = cha_path.reject(&:blank?)[0].try(:strip)
|
|
|
|
|
if game.status == 2 && game.final_score >= 0
|
|
|
|
|
exercise_cha_score = exercise_cha.question_score
|
|
|
|
|
answer_status = 1
|
|
|
|
|
if game.final_score >= 0
|
|
|
|
|
exercise_cha_score = game.real_score exercise_cha.question_score
|
|
|
|
|
answer_status = game.status == 2 ? 1 : 0
|
|
|
|
|
end
|
|
|
|
|
if exercise_cha.exercise_shixun_answers.where(:user_id => user.id).empty?
|
|
|
|
|
if GameCode.where(:game_id => game.try(:id), :path => challeng_path).first.present?
|
|
|
|
|