diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 79b22d571..fe04e04f8 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1390,7 +1390,7 @@ class ExercisesController < ApplicationController if @paging_type == "percent" @question_result_hash = ques_result_all.sort_by{|s| s[:percent]} else - @question_result_hash = ques_result_all.sort_by{|s| s["#{@paging_type}"]} + @question_result_hash = ques_result_all.sort_by{|s| s[:"#{@paging_type}"]} end @exercise_questions_count = @exercise_questions.size diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 7d50d1a66..280f571a4 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -220,13 +220,13 @@ module ExercisesHelper 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 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 #该问题的全部得分 if shixun_answered_scores == 0.0 - game_percent = 0.0 + game_percent = "0.0" 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 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| right_answer = (index == 0) if effictive_users_count == 0 - score_percent = 0.0 + score_percent = "0.0" else score_percent = (s.to_i / effictive_users_count.to_f ).round(3) end