|
|
|
@ -301,7 +301,32 @@ module ExercisesHelper
|
|
|
|
|
}
|
|
|
|
|
question_answer_infos.push(shixun_new_chas)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
elsif ex.question_type == Exercise::PROGRAM #编程题
|
|
|
|
|
ex_score = ex&.question_score
|
|
|
|
|
full_scores = effictive_users.search_exercise_answer("score",ex_score).size #满分人数
|
|
|
|
|
zero_scores = effictive_users.search_exercise_answer("score",0.0).size #包含为0分的,及未评阅的
|
|
|
|
|
main_scores_array = [full_scores,zero_scores]
|
|
|
|
|
main_scores_array.each_with_index do |s,index|
|
|
|
|
|
right_answer = (index == 0)
|
|
|
|
|
if effictive_users_count == 0 || s < 0
|
|
|
|
|
s = 0
|
|
|
|
|
score_percent = 0.0
|
|
|
|
|
else
|
|
|
|
|
score_percent = (s.to_i / effictive_users_count.to_f ).round(3)
|
|
|
|
|
end
|
|
|
|
|
answer_option = {
|
|
|
|
|
:choice_position => index+1,
|
|
|
|
|
:choice_text => index+1,
|
|
|
|
|
:choice_users_count => s,
|
|
|
|
|
:choice_percent => score_percent.round(2).to_s,
|
|
|
|
|
:right_answer => right_answer
|
|
|
|
|
}
|
|
|
|
|
question_answer_infos.push(answer_option)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
ques_option = {
|
|
|
|
|
:ques_title => ques_title,
|
|
|
|
|
:ques_less_title => ques_less_title, #副标题,仅实训题才有
|
|
|
|
|