From de0aa8bcddf77952cc6e5b4d9c02569582e378fc Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Thu, 18 Jul 2019 15:38:00 +0800 Subject: [PATCH] fixbug --- app/controllers/polls_controller.rb | 6 +++--- app/views/polls/common_header.json.jbuilder | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index 3fc17c661..9811cfa5a 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -205,15 +205,15 @@ class PollsController < ApplicationController @is_teacher_or = 1 @user_poll_answer = 3 #教师页面 end - poll_status = @poll.get_poll_status(current_user) + @poll_status = @poll.get_poll_status(current_user) poll_id_array = [@poll.id] @poll_publish_count = get_user_permission_course(poll_id_array,2).count #是否存在已发布的 @poll_unpublish_count = get_user_permission_course(poll_id_array,1).count #是否存在未发布的 if (@poll_publish_count == 0) && (@poll_unpublish_count == 0) #即表示没有分班 - if poll_status == 1 + if @poll_status == 1 @poll_unpublish_count = 1 #试卷未发布,且课堂没有分班的时候 - elsif poll_status == 2 + elsif @poll_status == 2 @poll_publish_count = 1 #试卷未发布,且课堂没有分班的时候 end end diff --git a/app/views/polls/common_header.json.jbuilder b/app/views/polls/common_header.json.jbuilder index 39c4ef811..b0a3d7374 100644 --- a/app/views/polls/common_header.json.jbuilder +++ b/app/views/polls/common_header.json.jbuilder @@ -1,5 +1,6 @@ json.course_is_end @course.is_end # true表示已结束,false表示未结束 -json.extract! @poll, :id,:polls_name,:polls_description,:polls_status,:show_result +json.extract! @poll, :id,:polls_name,:polls_description,:show_result +json.polls_status @poll_status json.user_permission do json.is_teacher_or @is_teacher_or