dev_forum
SylorHuang 5 years ago
parent 71c543f32e
commit 84b6110c56

@ -616,7 +616,7 @@ class ExerciseQuestionsController < ApplicationController
elsif params[:question_type].to_i == 2 && (params[:standard_answers].count > 1 || params[:question_choices].blank? || params[:question_choices].include?("")) #判断题的标准答案不能大于1个选项不能为空
normal_status(-1,"判断题选项不能为空/标准答案不能大于1个")
elsif params[:question_type].to_i <= 1 && (params[:question_choices].blank? || params[:question_choices].include?("") || params[:question_choices].count < 2) #选择题选项不能为空,且不能小于2
normal_status(-1,"选择题选项内容不能为空,且不能少于3个!")
normal_status(-1,"选择题选项内容不能为空,且不能少于2个!")
elsif params[:question_type].to_i == 3 && (params[:standard_answers].blank? || params[:standard_answers].count > 5 ) #填空题选项最多为5个,且如果为1个的话不允许修改is_ordered
normal_status(-1,"填空题标准答案不能为空/不能超过5个")
elsif params[:question_type].to_i == 4 && params[:standard_answers].count > 2 #简单题参考答案最多为1个

@ -167,10 +167,13 @@ module ExercisesHelper
ex_score = ex&.question_score
full_scores = effictive_users.search_exercise_answer("score",ex_score).count #满分人数
no_full_scores = effictive_users.exercise_no_full_scores(ex_score).count #部分分数人数
all_zero_scores = effictive_users.search_exercise_answer("score",0.0).count #包含为0分的及未评阅的
review_scores = ex.exercise_answer_comments.count #主观题的评阅数量
un_review_scores = effictive_users_count - review_scores #未评阅数
zero_scores = all_zero_scores - un_review_scores #已评阅且答案未0分的人数
zero_scores = effictive_users.search_exercise_answer("score",0.0).count #包含为0分的及未评阅的
# review_scores = ex.exercise_answer_comments.count #主观题的评阅数量
un_review_scores = effictive_users_count - full_scores - no_full_scores - zero_scores #未评阅数
if un_review_scores < 0
un_review_scores = 0
end
# zero_scores = all_zero_scores - un_review_scores #已评阅且答案未0分的人数
main_scores_array = [full_scores,no_full_scores,zero_scores,un_review_scores]
main_scores_array.each_with_index do |s,index|
if index == 0
@ -642,7 +645,11 @@ module ExercisesHelper
end
if student_status == 2 #当前为老师,或为学生且已提交
user_score_pre = exercise_answers.score_reviewed
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
if ques_type == 4 && user_score_pre.blank? #主观题时且没有大于0的分数时为空
user_score = nil
else
user_score = user_score_pre.present? ? user_score_pre.pluck(:score).sum : 0.0
end
end
if user_score.present? && (user_score > q.question_score)

Loading…
Cancel
Save