dev_forum
SylorHuang 6 years ago
parent 3f933be7dd
commit 4e7098a339

@ -1512,7 +1512,7 @@ class ExercisesController < ApplicationController
end end
def get_exercise_question_counts #获取试卷的问题数及总分数 def get_exercise_question_counts #获取试卷的问题数及总分数
exercise_questions = @exercise.exercise_questions.all exercise_questions = @exercise.exercise_questions.includes(:exercise_choices,:exercise_shixun_challenges,:exercise_answers,:exercise_shixun_answers,:exercise_answer_comments,:exercise_standard_answers)
@exercise_ques_count = exercise_questions.count # 全部的题目数 @exercise_ques_count = exercise_questions.count # 全部的题目数
@exercise_ques_scores = exercise_questions.pluck(:question_score).sum @exercise_ques_scores = exercise_questions.pluck(:question_score).sum

@ -47,7 +47,7 @@ class ExerciseUserPdfService
end end
def load_data def load_data
@exercise_questions = exercise.exercise_questions @exercise_questions = exercise.exercise_questions.includes(:exercise_choices,:exercise_shixun_challenges,:exercise_answers,:exercise_shixun_answers,:exercise_answer_comments,:exercise_standard_answers)
@exercise_ques_count = @exercise_questions.count # 全部的题目数 @exercise_ques_count = @exercise_questions.count # 全部的题目数
@exercise_ques_scores = @exercise_questions.pluck(:question_score).sum @exercise_ques_scores = @exercise_questions.pluck(:question_score).sum
@ -81,7 +81,6 @@ class ExerciseUserPdfService
@exercise_ques_shixun_count = exercise_ques_shixun.all.count @exercise_ques_shixun_count = exercise_ques_shixun.all.count
@exercise_ques_shixun_scores = exercise_ques_shixun.pluck(:question_score).sum @exercise_ques_shixun_scores = exercise_ques_shixun.pluck(:question_score).sum
@exercise_questions = @exercise_questions.includes(:exercise_choices,:exercise_shixun_challenges,:exercise_answers,:exercise_shixun_answers,:exercise_answer_comments,:exercise_standard_answers)
get_each_student_exercise(exercise.id,@exercise_questions,@ex_user_user.id) get_each_student_exercise(exercise.id,@exercise_questions,@ex_user_user.id)
end end

Loading…
Cancel
Save