diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index f10bc81ff..5fa5296d5 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -402,7 +402,7 @@ class ExercisesController < ApplicationController :position => c.position, :challenge_id => c.challenge_id, :shixun_id => q.shixun_id, - :question_score => q.question_score + :question_score => c.question_score } shixun_challenge_bank = exercise_bank_question.exercise_bank_shixun_challenges.new challenge_option shixun_challenge_bank.save diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 675e3283c..119226c87 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -1184,7 +1184,7 @@ class PollsController < ApplicationController def check_poll_commit_result poll_status = @poll.get_poll_status(current_user.id) commit_poll_user = @poll.poll_users.find_by_group_ids(current_user.id).commit_by_status(1) #当前用户已提交问卷的 - unless @user_course_identity < Course::STUDENT || (@poll.show_result && poll_status == 3 && commit_poll_user.present?) + unless (@user_course_identity < Course::STUDENT) || ((@poll.show_result == 1) && (poll_status == 3) && commit_poll_user.present?) normal_status(-1,"没有权限!") #当前为老师/问卷公开统计,且问卷已截止,且用户有过回答的 end end diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 9ea7578f2..e0db9c2bf 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -13,7 +13,8 @@ module ExercisesHelper ques_score = q.exercise_answers.search_answer_users("user_id",user_id).score_reviewed.pluck(:score).sum end - if ques_score == q.question_score #满分作答为正确 + if ques_score >= q.question_score #满分作答为正确 + ques_score = q.question_score stand_answer = 1 elsif ques_score > 0.0 #部分作答 stand_answer = 2 @@ -35,7 +36,8 @@ module ExercisesHelper exercise_sub_status.each do |s| sub_answer = s.exercise_answers.search_answer_users("user_id",user_id) #主观题只有一个回答 if sub_answer.present? && sub_answer.first.score >= 0.0 - if s.question_score == sub_answer.first.score + + if s.question_score <= sub_answer.first.score stand_status = 1 else stand_status = 2 diff --git a/app/models/poll.rb b/app/models/poll.rb index b498eda4e..ce5da17dd 100644 --- a/app/models/poll.rb +++ b/app/models/poll.rb @@ -145,7 +145,8 @@ class Poll < ApplicationRecord end if poll_answer_user.present? && poll_answer_user.start_at.blank? && user_poll_status == 3 - user_status = 4 + # user_status = 4 + user_status = 5 #问卷用户存在,且未开始答题,且问卷已截止时,返回未提交标示 end user_status diff --git a/app/views/polls/poll_lists.json.jbuilder b/app/views/polls/poll_lists.json.jbuilder index f134967c9..1ebccffeb 100644 --- a/app/views/polls/poll_lists.json.jbuilder +++ b/app/views/polls/poll_lists.json.jbuilder @@ -1,7 +1,6 @@ json.course do json.partial! "polls/course_name",locals:{course:@course} end - json.poll_types do if @poll_current_user_status == 0 json.published_count @poll_publish_count