dev_local
daiao 6 years ago
parent a2984aba78
commit 02934bbfb2

@ -963,9 +963,9 @@ class ExerciseController < ApplicationController
if @exercise_users_list.size != 0
if @order == "student_id"
@exercise_users_list = @exercise_users_list.includes(:user => {:user_extensions => []}).order("user_extensions.student_id #{@b_sort}")
@exercise_users_list = @exercise_users_list.includes(user: :user_extensions).order("user_extensions.student_id #{@b_sort}")
else
@exercise_users_list = @exercise_users_list.includes(:user => {:user_extensions => []}).order("#{@order} #{@b_sort}")
@exercise_users_list = @exercise_users_list.includes(user: :user_extensions).order("#{@order} #{@b_sort}")
end
end
@ -1405,7 +1405,7 @@ class ExerciseController < ApplicationController
score4 = 0
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|
exercise_qustions.includes(exercise_shixun_challenges: :exercise_shixun_answers).each do |question|
if question.question_type != 5
answer = get_user_answer(question, user)
standard_answer = get_user_standard_answer(question, user)
@ -1438,8 +1438,8 @@ class ExerciseController < ApplicationController
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?
game_code = GameCode.where(:game_id => game.try(:id), :path => challeng_path).first
game_code = GameCode.where(:game_id => game.try(:id), :path => challeng_path).first
if game_code.present?
code = game_code.try(:new_code)
else
begin
@ -1456,8 +1456,9 @@ class ExerciseController < ApplicationController
Rails.logger.info "commit_exercise---- #{@error_messages}"
end
end
ExerciseShixunAnswer.create(:exercise_question_id => question.id, :exercise_shixun_challenge_id => exercise_cha.id, :user_id => user.id,
:score => exercise_cha_score, :answer_text => code, :status => answer_status)
ExerciseShixunAnswer.create(:exercise_question_id => question.id, :exercise_shixun_challenge_id => exercise_cha.id,
:user_id => user.id, :score => exercise_cha_score, :answer_text => code,
:status => answer_status)
end
score4 += exercise_cha_score

Loading…
Cancel
Save