|
|
@ -216,10 +216,19 @@ module ExercisesHelper
|
|
|
|
ex.exercise_shixun_challenges.each do |c|
|
|
|
|
ex.exercise_shixun_challenges.each do |c|
|
|
|
|
cha_score = c&.question_score
|
|
|
|
cha_score = c&.question_score
|
|
|
|
cha_shixun_answer = effictive_users.search_shixun_keys("exercise_shixun_challenge_id",c.id)
|
|
|
|
cha_shixun_answer = effictive_users.search_shixun_keys("exercise_shixun_challenge_id",c.id)
|
|
|
|
effictive_users_count = cha_shixun_answer.count #实训题的每个关卡的有效填写量
|
|
|
|
effictive_users_count = cha_shixun_answer.size #实训题的每个关卡的有效填写量
|
|
|
|
full_scores = cha_shixun_answer.search_shixun_keys("score",cha_score).count #满分人数
|
|
|
|
full_scores = cha_shixun_answer.search_shixun_keys("score",cha_score).size #满分人数
|
|
|
|
no_full_scores = cha_shixun_answer.shixun_no_full_scores(cha_score).count #部分分数人数c
|
|
|
|
no_full_scores = cha_shixun_answer.shixun_no_full_scores(cha_score).size #部分分数人数c
|
|
|
|
all_zero_scores = cha_shixun_answer.search_shixun_keys("score",0.0).count #满分人数
|
|
|
|
all_zero_scores = cha_shixun_answer.search_shixun_keys("score",0.0).size #零分人数
|
|
|
|
|
|
|
|
shiun_scores = user_ids.count * cha_score
|
|
|
|
|
|
|
|
shixun_answered_scores = cha_shixun_answer.score_reviewed.pluck(:score).sum #该问题的全部得分
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if shixun_answered_scores == 0.0
|
|
|
|
|
|
|
|
game_percent = 0.0
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
game_percent = (shixun_answered_scores / shiun_scores.to_f).round(3) * 100 #正确率
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
shixun_score_array = [full_scores,no_full_scores,all_zero_scores]
|
|
|
|
shixun_score_array = [full_scores,no_full_scores,all_zero_scores]
|
|
|
|
shixun_chas = []
|
|
|
|
shixun_chas = []
|
|
|
|
shixun_score_array.each_with_index do |s,index|
|
|
|
|
shixun_score_array.each_with_index do |s,index|
|
|
|
@ -242,7 +251,8 @@ module ExercisesHelper
|
|
|
|
:cha_id => c.challenge_id,
|
|
|
|
:cha_id => c.challenge_id,
|
|
|
|
:cha_name => c.challenge.subject,
|
|
|
|
:cha_name => c.challenge.subject,
|
|
|
|
:cha_position => c.position,
|
|
|
|
:cha_position => c.position,
|
|
|
|
:cha_details => shixun_chas
|
|
|
|
:cha_details => shixun_chas,
|
|
|
|
|
|
|
|
:cha_percent => game_percent
|
|
|
|
}
|
|
|
|
}
|
|
|
|
question_answer_infos.push(shixun_new_chas)
|
|
|
|
question_answer_infos.push(shixun_new_chas)
|
|
|
|
end
|
|
|
|
end
|
|
|
|