Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
cxt 6 years ago
commit f76fc8d7fe

@ -1510,39 +1510,42 @@ 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
@exercise_ques_count = exercise_questions.count # 全部的题目数 @exercise_ques_count = exercise_questions.size # 全部的题目数
@exercise_ques_scores = exercise_questions.pluck(:question_score).sum @exercise_ques_scores = exercise_questions.pluck(:question_score).sum
#单选题的数量及分数 #单选题的数量及分数
exercise_single_ques = exercise_questions.find_by_custom("question_type",0) exercise_single_ques = exercise_questions.find_by_custom("question_type",0)
@exercise_single_ques_count = exercise_single_ques.all.count @exercise_single_ques_count = exercise_single_ques.size
@exercise_single_ques_scores = exercise_single_ques.pluck(:question_score).sum @exercise_single_ques_scores = exercise_single_ques.pluck(:question_score).sum
#多选题的数量及分数 #多选题的数量及分数
exercise_double_ques = exercise_questions.find_by_custom("question_type",1) exercise_double_ques = exercise_questions.find_by_custom("question_type",1)
@exercise_double_ques_count = exercise_double_ques.all.count @exercise_double_ques_count = exercise_double_ques.size
@exercise_double_ques_scores = exercise_double_ques.pluck(:question_score).sum @exercise_double_ques_scores = exercise_double_ques.pluck(:question_score).sum
# 判断题数量及分数 # 判断题数量及分数
exercise_ques_judge = exercise_questions.find_by_custom("question_type",2) exercise_ques_judge = exercise_questions.find_by_custom("question_type",2)
@exercise_ques_judge_count = exercise_ques_judge.all.count @exercise_ques_judge_count = exercise_ques_judge.size
@exercise_ques_judge_scores = exercise_ques_judge.pluck(:question_score).sum @exercise_ques_judge_scores = exercise_ques_judge.pluck(:question_score).sum
#填空题数量及分数 #填空题数量及分数
exercise_ques_null = exercise_questions.find_by_custom("question_type",3) exercise_ques_null = exercise_questions.find_by_custom("question_type",3)
@exercise_ques_null_count = exercise_ques_null.all.count @exercise_ques_null_count = exercise_ques_null.size
@exercise_ques_null_scores = exercise_ques_null.pluck(:question_score).sum @exercise_ques_null_scores = exercise_ques_null.pluck(:question_score).sum
#简答题数量及分数 #简答题数量及分数
exercise_ques_main = exercise_questions.find_by_custom("question_type",4) exercise_ques_main = exercise_questions.find_by_custom("question_type",4)
@exercise_ques_main_count = exercise_ques_main.all.count @exercise_ques_main_count = exercise_ques_main.size
@exercise_ques_main_scores = exercise_ques_main.pluck(:question_score).sum @exercise_ques_main_scores = exercise_ques_main.pluck(:question_score).sum
#实训题数量及分数 #实训题数量及分数
exercise_ques_shixun = exercise_questions.find_by_custom("question_type",5) exercise_ques_shixun = exercise_questions.find_by_custom("question_type",5)
@exercise_ques_shixun_count = exercise_ques_shixun.all.count @exercise_ques_shixun_count = exercise_ques_shixun.size
@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)
end end
#获取用户有权限的分班 #获取用户有权限的分班

@ -1233,7 +1233,7 @@ class HomeworkCommonsController < ApplicationController
# 代码查重届结果 # 代码查重届结果
def code_review_results def code_review_results
# 如果有未获取结果的查重操作 则先读取结果 # 如果有未获取结果的查重操作 则先读取结果
get_new_code_reviews_result @homework #get_new_code_reviews_result @homework
@current_user = current_user @current_user = current_user
# 列表数据 # 列表数据

@ -33,11 +33,11 @@ class Discuss < ApplicationRecord
"/tasks/#{game&.identifier}" "/tasks/#{game&.identifier}"
end end
def contents(shixun, user) # def contents(shixun, user)
return content unless hidden? # return content unless hidden?
#
shixun.has_manager?(user) ? content : '' # shixun.has_manager?(user) ? content : ''
end # end
def child_discuss(user) def child_discuss(user)
user.admin? ? user.admin? ?

@ -48,40 +48,40 @@ class ExerciseUserPdfService
def load_data def load_data
@exercise_questions = exercise.exercise_questions @exercise_questions = exercise.exercise_questions
@exercise_ques_count = @exercise_questions.count # 全部的题目数 @exercise_ques_count = @exercise_questions.size # 全部的题目数
@exercise_ques_scores = @exercise_questions.pluck(:question_score).sum @exercise_ques_scores = @exercise_questions.pluck(:question_score).sum
#单选题的数量及分数 #单选题的数量及分数
exercise_single_ques = @exercise_questions.find_by_custom("question_type",0) exercise_single_ques = @exercise_questions.find_by_custom("question_type",0)
@exercise_single_ques_count = exercise_single_ques.all.count @exercise_single_ques_count = exercise_single_ques.size
@exercise_single_ques_scores = exercise_single_ques.pluck(:question_score).sum @exercise_single_ques_scores = exercise_single_ques.pluck(:question_score).sum
#多选题的数量及分数 #多选题的数量及分数
exercise_double_ques = @exercise_questions.find_by_custom("question_type",1) exercise_double_ques = @exercise_questions.find_by_custom("question_type",1)
@exercise_double_ques_count = exercise_double_ques.all.count @exercise_double_ques_count = exercise_double_ques.size
@exercise_double_ques_scores = exercise_double_ques.pluck(:question_score).sum @exercise_double_ques_scores = exercise_double_ques.pluck(:question_score).sum
# 判断题数量及分数 # 判断题数量及分数
exercise_ques_judge = @exercise_questions.find_by_custom("question_type",2) exercise_ques_judge = @exercise_questions.find_by_custom("question_type",2)
@exercise_ques_judge_count = exercise_ques_judge.all.count @exercise_ques_judge_count = exercise_ques_judge.size
@exercise_ques_judge_scores = exercise_ques_judge.pluck(:question_score).sum @exercise_ques_judge_scores = exercise_ques_judge.pluck(:question_score).sum
#填空题数量及分数 #填空题数量及分数
exercise_ques_null = @exercise_questions.find_by_custom("question_type",3) exercise_ques_null = @exercise_questions.find_by_custom("question_type",3)
@exercise_ques_null_count = exercise_ques_null.all.count @exercise_ques_null_count = exercise_ques_null.size
@exercise_ques_null_scores = exercise_ques_null.pluck(:question_score).sum @exercise_ques_null_scores = exercise_ques_null.pluck(:question_score).sum
#简答题数量及分数 #简答题数量及分数
exercise_ques_main = @exercise_questions.find_by_custom("question_type",4) exercise_ques_main = @exercise_questions.find_by_custom("question_type",4)
@exercise_ques_main_count = exercise_ques_main.all.count @exercise_ques_main_count = exercise_ques_main.size
@exercise_ques_main_scores = exercise_ques_main.pluck(:question_score).sum @exercise_ques_main_scores = exercise_ques_main.pluck(:question_score).sum
#实训题数量及分数 #实训题数量及分数
exercise_ques_shixun = @exercise_questions.find_by_custom("question_type",5) exercise_ques_shixun = @exercise_questions.find_by_custom("question_type",5)
@exercise_ques_shixun_count = exercise_ques_shixun.all.count @exercise_ques_shixun_count = exercise_ques_shixun.size
@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) @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

@ -2,7 +2,7 @@ json.author do
json.partial! 'users/user', user: discuss.user json.partial! 'users/user', user: discuss.user
end end
json.id discuss.id json.id discuss.id
json.content discuss.contents json.content discuss.content
json.time time_from_now(discuss.created_at) json.time time_from_now(discuss.created_at)
json.position discuss.position json.position discuss.position
json.shixun_id discuss.dis_id json.shixun_id discuss.dis_id

Loading…
Cancel
Save