|
|
|
@ -178,7 +178,7 @@ module ExercisesHelper
|
|
|
|
|
null_stand_choice.each_with_index do |s,index|
|
|
|
|
|
s_choice_text = null_stand_text[index]
|
|
|
|
|
user_count = 0
|
|
|
|
|
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.pluck(:user_id).uniq.size
|
|
|
|
|
user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.distinct.size
|
|
|
|
|
# user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size
|
|
|
|
|
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
|
|
|
|
|
answer_option = {
|
|
|
|
@ -193,18 +193,21 @@ module ExercisesHelper
|
|
|
|
|
standard_answer_count += 1
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
cycled_stand = {}
|
|
|
|
|
null_stand_text.each_with_index do |stand, index|
|
|
|
|
|
# cycled_stand = {}
|
|
|
|
|
null_stand_text.uniq.each_with_index do |stand, index|
|
|
|
|
|
user_count = 0
|
|
|
|
|
if cycled_stand.length > 0 && cycled_stand.keys.include?(stand)
|
|
|
|
|
cycled_stand.store(stand, cycled_stand["#{stand}"])
|
|
|
|
|
user_count = cycled_stand["#{stand}"]
|
|
|
|
|
calculate_user_count = 0
|
|
|
|
|
else
|
|
|
|
|
user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
|
|
|
|
|
cycled_stand.store(stand, user_count)
|
|
|
|
|
calculate_user_count = user_count
|
|
|
|
|
end
|
|
|
|
|
# if cycled_stand.length > 0 && cycled_stand.keys.include?(stand)
|
|
|
|
|
# cycled_stand.store(stand, cycled_stand["#{stand}"])
|
|
|
|
|
# user_count = cycled_stand["#{stand}"]
|
|
|
|
|
# calculate_user_count = 0
|
|
|
|
|
# else
|
|
|
|
|
# user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.pluck(:user_id).uniq.size
|
|
|
|
|
# cycled_stand.store(stand, user_count)
|
|
|
|
|
# calculate_user_count = user_count
|
|
|
|
|
# end
|
|
|
|
|
user_count = user_count + effictive_users.select{|answer| answer.answer_text == stand }.distinct.size
|
|
|
|
|
# cycled_stand.store(stand, user_count)
|
|
|
|
|
# calculate_user_count = user_count
|
|
|
|
|
|
|
|
|
|
answer_percent = ((effictive_users_count == 0) ? 0.0 : (user_count / effictive_users_count.to_f ).round(3))
|
|
|
|
|
answer_option = {
|
|
|
|
@ -215,7 +218,7 @@ module ExercisesHelper
|
|
|
|
|
:right_answer => true
|
|
|
|
|
}
|
|
|
|
|
question_answer_infos.push(answer_option)
|
|
|
|
|
all_user_count += calculate_user_count
|
|
|
|
|
all_user_count += user_count
|
|
|
|
|
standard_answer_count += 1
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|