试卷的统计结果列表排序修改

competitions
SylorHuang 5 years ago
parent 00d6de4499
commit e7b0d82a60

@ -46,7 +46,7 @@ class Admins::ShixunSettingsController < Admins::BaseController
tag_ids.each do |id|
unless tag_repertoire_ids.include?(id)
tag_repertoire = @shixun.shixun_tag_repertoires.new(shixun_id:@shixun.id,tag_repertoire_id:id)
tag_repertoire.save
tag_repertoire.save!
end
end
else

@ -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)
@paging_type = "percent"
# 按题型排序
percent_sort = "desc"
if params[:sort].present?
@paging_type = params[:sort].to_s
percent_sort = params[:sort]
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)
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
@question_result_hash = ques_result_all.sort_by{|s| s[:"#{@paging_type}"]}
@question_result_hash = ques_result_all.sort_by{|s| s[:percent]}
end
@exercise_questions_count = @exercise_questions.size

Loading…
Cancel
Save