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

dev_forum
jingquan huang 6 years ago
commit 87f7cd3853

@ -630,14 +630,16 @@ module ExercisesHelper
user_score = nil
shixun_type = 0
question_comment = []
if q.question_type == 5
if ques_type == 5
exercise_answers = q.exercise_shixun_answers.search_shixun_answers("user_id",ex_answerer_id)
else
exercise_answers = q.exercise_answers.search_exercise_answer("user_id",ex_answerer_id) #试卷用户的回答
end
if student_status == 2 #当前为老师,或为学生且已提交
user_score = exercise_answers.score_reviewed.pluck(:score).sum
user_score_pre = exercise_answers.score_reviewed.pluck(:score).sum
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : nil
end
if user_score.present? && (user_score > q.question_score)
user_score = q.question_score
end
@ -667,7 +669,7 @@ module ExercisesHelper
question_comment = q.exercise_answer_comments.search_answer_comments("exercise_answer_id",q_answer_id)
end
{
"user_score": user_score.present? ? user_score.round(1) : nil,
"user_score": (user_score.present? ? user_score.round(1).to_s : nil),
"answered_content":answered_content,
"shixun_type":shixun_type,
"question_comment":question_comment

@ -16,7 +16,7 @@ class HomeworkEvaluationCommentAssginJob < ApplicationJob
student_work_projects = homework_common.student_works.where("work_status != 0").shuffle
student_work_projects.each do |pro_work|
n = homework_detail_manual.evaluation_num
n = (n < student_works.size && n != -1) ? n : student_works.size - 1
n = (n < student_works.length && n != -1) ? n : student_works.length - 1
work_index = -1
student_works.each_with_index do |stu_work, stu_index|
if stu_work.group_id.to_i == pro_work.group_id.to_i

@ -170,7 +170,7 @@ class HomeworkCommon < ApplicationRecord
#删除时更新题库中的引用数
def update_homework_bank_quotes
old_bank = self.homework_bank
old_bank.update_attributes(quotes: (old_bank.quotes - 1) > 0 ? (old_bank.quotes - 1) : 0, homework_common_id: nil)
old_bank.update_attributes(quotes: (old_bank.quotes - 1) > 0 ? (old_bank.quotes - 1) : 0, homework_common_id: nil) if old_bank.present?
end
# 查重是否有新结果

@ -47,14 +47,13 @@ end
json.exercise_questions do
json.array! exercise_questions do |q|
user_ques_answers = user_question_answers(q,ex_answerer.id,student_status,is_teacher_or,exercise_status,q.question_type,ex_type)
user_ques_comments = user_ques_answers[:question_comment]
if all_question_status.size > 0
this_ques_status = all_question_status.detect {|f| f[:q_id] == q.id}
json.answer_status this_ques_status[:stand_status]
end
json.user_score user_ques_answers[:user_score].present? ? user_ques_answers[:user_score].to_s : nil
json.user_score user_ques_answers[:user_score]
json.partial! "exercise_questions/exercise_questions",
question: q,
ex_answerer: ex_answerer,

Loading…
Cancel
Save