|
|
@ -1425,18 +1425,24 @@ class ExercisesController < ApplicationController
|
|
|
|
|
|
|
|
|
|
|
|
@exercise_questions = @exercise.exercise_questions&.includes(:exercise_choices,:exercise_answers,:exercise_standard_answers,:exercise_shixun_challenges,:exercise_shixun_answers)
|
|
|
|
@exercise_questions = @exercise.exercise_questions&.includes(:exercise_choices,:exercise_answers,:exercise_standard_answers,:exercise_shixun_challenges,:exercise_shixun_answers)
|
|
|
|
|
|
|
|
|
|
|
|
@paging_type = "percent"
|
|
|
|
percent_sort = "desc"
|
|
|
|
# 按题型排序
|
|
|
|
|
|
|
|
if params[:sort].present?
|
|
|
|
if params[:sort].present?
|
|
|
|
@paging_type = params[:sort].to_s
|
|
|
|
percent_sort = params[:sort]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# @paging_type = "percent"
|
|
|
|
|
|
|
|
# # 按题型排序
|
|
|
|
|
|
|
|
# if params[:sort].present?
|
|
|
|
|
|
|
|
# @paging_type = params[:sort].to_s
|
|
|
|
|
|
|
|
# end
|
|
|
|
|
|
|
|
|
|
|
|
ques_result_all = exercise_commit_result(@exercise_questions,@exercise_commit_user_ids)
|
|
|
|
ques_result_all = exercise_commit_result(@exercise_questions,@exercise_commit_user_ids)
|
|
|
|
|
|
|
|
|
|
|
|
if @paging_type == "percent"
|
|
|
|
#默认降序排列
|
|
|
|
@question_result_hash = ques_result_all.sort_by{|s| s[:percent]}
|
|
|
|
if percent_sort == "desc"
|
|
|
|
|
|
|
|
@question_result_hash = ques_result_all.sort_by{|s| s[:percent]}.reverse
|
|
|
|
else
|
|
|
|
else
|
|
|
|
@question_result_hash = ques_result_all.sort_by{|s| s[:"#{@paging_type}"]}
|
|
|
|
@question_result_hash = ques_result_all.sort_by{|s| s[:percent]}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
@exercise_questions_count = @exercise_questions.size
|
|
|
|
@exercise_questions_count = @exercise_questions.size
|
|
|
|