|
|
|
if @exercise_course_groups.present? && @exercise_course_groups.count > 0
|
|
|
|
json.course_groups do
|
|
|
|
json.array! @exercise_course_groups do |group|
|
|
|
|
json.exercise_group_id group[:course_id] #班级id
|
|
|
|
json.exercise_group_name group[:course_name] #班级名称
|
|
|
|
json.exercise_group_students group[:student_count] #班级人数
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
json.course_groups []
|
|
|
|
end
|
|
|
|
|
|
|
|
#试卷分数的统计
|
|
|
|
|
|
|
|
json.exercise_counts do
|
|
|
|
json.commit_percent @counts_array[:commit_percent]
|
|
|
|
json.min_score @counts_array[:min_score]
|
|
|
|
json.max_score @counts_array[:max_score]
|
|
|
|
json.average_score @counts_array[:average_score].to_s
|
|
|
|
json.fail_counts @counts_array[:fail_counts]
|
|
|
|
json.pass_counts @counts_array[:pass_counts]
|
|
|
|
json.good_counts @counts_array[:good_counts]
|
|
|
|
json.best_counts @counts_array[:best_counts]
|
|
|
|
end
|
|
|
|
|
|
|
|
json.questions_count @exercise_questions_count
|
|
|
|
json.commit_results do
|
|
|
|
json.array! @question_result_hash do |q|
|
|
|
|
json.ques_title q[:ques_title]
|
|
|
|
json.ques_less_title q[:ques_less_title]
|
|
|
|
json.ques_type q[:type]
|
|
|
|
json.ques_position q[:position]
|
|
|
|
json.right_percent q[:percent]
|
|
|
|
json.effictive_counts q[:ques_effictive_counts]
|
|
|
|
if q[:type] != Exercise::PRACTICAL
|
|
|
|
json.ques_details do
|
|
|
|
json.array! q[:ques_details].each_with_index.to_a do |d,index|
|
|
|
|
if q[:type] <= Exercise::MULTIPLE
|
|
|
|
ques_index = (index+65).chr
|
|
|
|
elsif q[:type] == Exercise::JUDGMENT
|
|
|
|
ques_index = (index+1).to_s
|
|
|
|
else
|
|
|
|
ques_index = ""
|
|
|
|
end
|
|
|
|
json.choice_position d[:choice_position]
|
|
|
|
json.choice_text "#{ques_index}.#{d[:choice_text]}"
|
|
|
|
json.choice_users_count d[:choice_users_count]
|
|
|
|
json.choice_percent d[:choice_percent]
|
|
|
|
json.choice_right_boolean d[:right_answer]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
json.ques_details do
|
|
|
|
json.array! q[:ques_details] do |cha|
|
|
|
|
json.challenge_id cha[:cha_id]
|
|
|
|
json.challenge_name cha[:cha_name]
|
|
|
|
json.challenge_position cha[:cha_position]
|
|
|
|
json.challenge_percent cha[:cha_percent]
|
|
|
|
json.challenge_details do
|
|
|
|
json.array! cha[:cha_details].each_with_index.to_a do |ch,index|
|
|
|
|
json.choice_position ch[:choice_position]
|
|
|
|
json.choice_text "#{(index+1).to_s}.#{ch[:choice_text]}"
|
|
|
|
json.choice_users_count ch[:choice_users_count]
|
|
|
|
json.choice_percent ch[:choice_percent]
|
|
|
|
json.choice_right_boolean ch[:right_answer]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|