dev_course
SylorHuang 6 years ago
parent 38c14f9991
commit 4e65aaa214

@ -1023,7 +1023,7 @@ class ExercisesController < ApplicationController
if @t_user_exercise_status == 3 if @t_user_exercise_status == 3
get_each_student_exercise(@exercise.id,@exercise_questions,@exercise_current_user_id) get_each_student_exercise(@exercise.id,@exercise_questions,@exercise_current_user_id)
end end
get_user_answer_status(@exercise_questions,@exercise_current_user_id) get_user_answer_status(@exercise_questions,@exercise_current_user_id,@exercise,@t_user_exercise_status)
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)
@ -1117,7 +1117,7 @@ class ExercisesController < ApplicationController
@student_status = 0 @student_status = 0
else else
@student_status = 1 @student_status = 1
get_user_answer_status(@exercise_questions,@exercise_current_user_id) get_user_answer_status(@exercise_questions,@exercise_current_user_id,@exercise,get_exercise_status)
end end
end end
end end
@ -1685,11 +1685,17 @@ class ExercisesController < ApplicationController
end end
end end
def get_user_answer_status(exercise_questions,user_id) def get_user_answer_status(exercise_questions,user_id,exercise,exercise_user_status)
@question_status = [] @question_status = []
@exercise_all_questions = [] @exercise_all_questions = []
ex_question_random = exercise.question_random
question_answered = 0 question_answered = 0
exercise_questions.each_with_index do |q,index| exercise_questions.each_with_index do |q,index|
if ex_question_random && exercise_user_status != 3
ques_number = index + 1
else
ques_number = q.question_number
end
if q.question_type != 5 if q.question_type != 5
ques_vote = q.exercise_answers.search_exercise_answer("user_id",user_id) ques_vote = q.exercise_answers.search_exercise_answer("user_id",user_id)
else else
@ -1725,12 +1731,12 @@ class ExercisesController < ApplicationController
end end
question_status = { question_status = {
:ques_id => q.id, :ques_id => q.id,
:ques_number => index+1, #仅问题的显示位置变化但是问题的question_number 不会变化与之相关的choice/standard_answer/answer不会变化 :ques_number => ques_number, #仅问题的显示位置变化但是问题的question_number 不会变化与之相关的choice/standard_answer/answer不会变化
:ques_status => ques_status, :ques_status => ques_status,
} }
question_options = { question_options = {
:question => q, :question => q,
:ques_number => index+1, :ques_number => ques_number,
} }
@question_status = @question_status.push(question_status).sort_by {|k| k[:ques_number]} @question_status = @question_status.push(question_status).sort_by {|k| k[:ques_number]}
@exercise_all_questions = @exercise_all_questions.push(question_options).sort_by {|k| k[:ques_number]} @exercise_all_questions = @exercise_all_questions.push(question_options).sort_by {|k| k[:ques_number]}

@ -323,6 +323,7 @@ module ExercisesHelper
else else
show_unreview_count = nil show_unreview_count = nil
end end
logger.info("##########__________exercise_end_time__________###############{exercise_end_time}")
if exercise_status == 2 && exercise_end_time.present? if exercise_status == 2 && exercise_end_time.present?
ex_left_time = how_much_time(exercise_end_time) ex_left_time = how_much_time(exercise_end_time)

Loading…
Cancel
Save