From 939a536d3a916de320fd53141ea38526e547f000 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Wed, 26 Jun 2019 18:29:45 +0800 Subject: [PATCH] fix bug --- app/controllers/exercises_controller.rb | 2 +- app/controllers/polls_controller.rb | 3 +-- app/views/polls/poll_lists.json.jbuilder | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) 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 be3316df6..119226c87 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -951,7 +951,6 @@ class PollsController < ApplicationController def poll_lists ActiveRecord::Base.transaction do begin - @poll_new_users = @poll.poll_users.find_by(user_id:current_user.id) poll_ids = [@poll.id] @poll_list_status = @poll.get_poll_status(current_user.id) @poll_publish_count = get_user_permission_course(poll_ids,2).count @@ -1185,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/views/polls/poll_lists.json.jbuilder b/app/views/polls/poll_lists.json.jbuilder index b83e767a1..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.current_poll_user @poll_new_users.present? ? @poll_new_users.id : "---" json.poll_types do if @poll_current_user_status == 0 json.published_count @poll_publish_count