试卷的位置问题和标准答案的算分问题

dev_hs
SylorHuang 6 years ago
parent 7985bd3896
commit 2f67425e2a

@ -403,6 +403,12 @@ module ExercisesHelper
end
user_answer_content = answer_choice_array.sort
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
#TODO: 旧版多选题的标准答案是放在一个里面的新版又做成了一个题有多个标准答案exercise_choice_id存放的是标准答案的位置..
if q.question_type == 1 && standard_answer.size == 1
standard_answer = standard_answer.first.to_s.split("").map(&:to_i)
end
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
if standard_answer.size > 0
q_score_1 = q.question_score

@ -0,0 +1,16 @@
class ChangeExercise1930Position < ActiveRecord::Migration[5.2]
def change
#正式版的1930试卷的位置出现问题
#
ex = Exercise.find_by(id:1930)
ex.exercise_questions.each_with_index do |q,index|
q.update_attributes(question_number:index+1)
end
ex_q_bank = ex.exercise_bank.exercise_bank_questions
ex_q_bank.each_with_index do |q,index|
q.update_attributes(question_number:index+1)
end
end
end

@ -103,6 +103,13 @@ namespace :excellent_course_exercise do
end
user_answer_content = answer_choice_array.sort
standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个
#TODO: 旧版多选题的标准答案是放在一个里面的新版又做成了一个题有多个标准答案exercise_choice_id存放的是标准答案的位置..
if q.question_type == 1 && standard_answer.size == 1
standard_answer = standard_answer.first.to_s.split("").map(&:to_i)
end
if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分
if standard_answer.size > 0
q_score_1 = q.question_score

Loading…
Cancel
Save