|
|
@ -220,13 +220,13 @@ module ExercisesHelper
|
|
|
|
full_scores = cha_shixun_answer.search_shixun_keys("score",cha_score).size #满分人数
|
|
|
|
full_scores = cha_shixun_answer.search_shixun_keys("score",cha_score).size #满分人数
|
|
|
|
no_full_scores = cha_shixun_answer.shixun_no_full_scores(cha_score).size #部分分数人数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).size #零分人数
|
|
|
|
all_zero_scores = cha_shixun_answer.search_shixun_keys("score",0.0).size #零分人数
|
|
|
|
shiun_scores = user_ids.count * cha_score
|
|
|
|
shixun_scores = user_ids.count * cha_score
|
|
|
|
shixun_answered_scores = cha_shixun_answer.score_reviewed.pluck(:score).sum #该问题的全部得分
|
|
|
|
shixun_answered_scores = cha_shixun_answer.score_reviewed.pluck(:score).sum #该问题的全部得分
|
|
|
|
|
|
|
|
|
|
|
|
if shixun_answered_scores == 0.0
|
|
|
|
if shixun_answered_scores == 0.0
|
|
|
|
game_percent = 0.0
|
|
|
|
game_percent = "0.0"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
game_percent = (shixun_answered_scores / shiun_scores.to_f).round(3) * 100 #正确率
|
|
|
|
game_percent = (shixun_answered_scores / shixun_scores.to_f).round(3) * 100 #正确率
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
shixun_score_array = [full_scores,no_full_scores,all_zero_scores]
|
|
|
|
shixun_score_array = [full_scores,no_full_scores,all_zero_scores]
|
|
|
@ -234,7 +234,7 @@ module ExercisesHelper
|
|
|
|
shixun_score_array.each_with_index do |s,index|
|
|
|
|
shixun_score_array.each_with_index do |s,index|
|
|
|
|
right_answer = (index == 0)
|
|
|
|
right_answer = (index == 0)
|
|
|
|
if effictive_users_count == 0
|
|
|
|
if effictive_users_count == 0
|
|
|
|
score_percent = 0.0
|
|
|
|
score_percent = "0.0"
|
|
|
|
else
|
|
|
|
else
|
|
|
|
score_percent = (s.to_i / effictive_users_count.to_f ).round(3)
|
|
|
|
score_percent = (s.to_i / effictive_users_count.to_f ).round(3)
|
|
|
|
end
|
|
|
|
end
|
|
|
|