diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 2c1a6f85d..ea58ddb55 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -180,17 +180,19 @@ module ExercisesHelper elsif ex.question_type == Exercise::COMPLETION #填空题 ex_ordered = ex.is_ordered null_standard_answer = ex.exercise_standard_answers - null_stand_choice = null_standard_answer.pluck(:exercise_choice_id) #一个exercise_choice_id可能对应多个answer_text + null_stand_choice = null_standard_answer.pluck(:exercise_choice_id).uniq #一个exercise_choice_id可能对应多个answer_text null_stand_text = null_standard_answer.pluck(:answer_text) standard_answer_count = 0 each_null_score = null_stand_choice.size > 0 ? (ex&.question_score.to_f / null_stand_choice.uniq.size).round(3) : 0.0 all_user_count = 0 null_stand_choice.each_with_index do |s,index| user_count = 0 - s_choice_text = null_stand_text[index] if ex_ordered #有序排列 + s_choice_text = null_stand_text[index] user_count = user_count + effictive_users.select{|answer| answer.exercise_choice_id == s && answer.answer_text == s_choice_text}.size else + null_stand_text = null_stand_text.uniq + s_choice_text = null_stand_text[index] user_count = user_count + effictive_users.select{|answer| answer.answer_text == s_choice_text }.size #回答了标准答案的用户 end @@ -211,7 +213,7 @@ module ExercisesHelper # percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0 - user_wrong_count = (effictive_users_count - all_user_count ) + user_wrong_count = (effictive_users_count - all_user_count) if effictive_users_count > 0 && user_wrong_count >= 0 wrong_percent = (user_wrong_count / effictive_users_count.to_f ).round(3) diff --git a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js index ed02b939c..611e06464 100644 --- a/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js +++ b/public/react/src/modules/courses/coursesPublic/ModulationModal_exercise.js @@ -355,7 +355,9 @@ class ModulationModal_exercise extends Component { "" } -
客观题成绩:
{Inputsvaltests} : "" } + +{ pollDetail.poll.polls_description }
} -- { !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" : - - { - pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 && - 合计{pollDetail.question_types && pollDetail.question_types.q_counts}题: - } - { - pollDetail && pollDetail.question_types.q_singles > 0 && - 单选题{pollDetail.question_types.q_singles}题 - } - { - pollDetail && pollDetail.question_types.q_doubles > 0 && - 多选题{pollDetail.question_types.q_doubles}题 - } - { - pollDetail && pollDetail.question_types.q_mains > 0 && - 主观题{pollDetail.question_types.q_mains}题 - } - - } -
- { - pollDetail && pollDetail.questions && pollDetail.questions.map((item,key)=>{ + pollDetail && pollDetail.questions && pollDetail.questions.length > 0 && ++ { !pollDetail || !pollDetail.question_types || pollDetail.question_types.q_counts===0 ? "" : + + { + pollDetail && pollDetail.question_types && pollDetail.question_types.q_counts > 0 && + 合计{pollDetail.question_types && pollDetail.question_types.q_counts}题: + } + { + pollDetail && pollDetail.question_types.q_singles > 0 && + 单选题{pollDetail.question_types.q_singles}题 + } + { + pollDetail && pollDetail.question_types.q_doubles > 0 && + 多选题{pollDetail.question_types.q_doubles}题 + } + { + pollDetail && pollDetail.question_types.q_mains > 0 && + 主观题{pollDetail.question_types.q_mains}题 + } + + } +
+ } + + { + pollDetail && pollDetail.questions && pollDetail.questions.length > 0 && pollDetail.questions.map((item,key)=>{ return(
@@ -120,6 +124,10 @@ class PollDetailTabThirdInfo extends Component{
)
})
}
+
+ {
+ pollDetail && pollDetail.questions && pollDetail.questions.length == 0 &&