From ca5bb884ae3d0c7a65a62a21b28054b584ba2934 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 22 Oct 2019 10:19:35 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=AE=E7=AD=94=E7=9A=84start=5Fanswer?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/polls_controller.rb | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/app/controllers/polls_controller.rb b/app/controllers/polls_controller.rb index cb507fdcb..bbd2a06fa 100644 --- a/app/controllers/polls_controller.rb +++ b/app/controllers/polls_controller.rb @@ -900,12 +900,30 @@ class PollsController < ApplicationController # 判断是否已经回答还是新建的回答 @poll_questions.each do |q| ques_vote = q.poll_votes.find_current_vote("user_id",@poll_current_user_id) - if ques_vote.present? - ques_status = 1 - question_answered += 1 + ques_type = q.question_type + + if ques_type != 3 #非简答题时 + if ques_vote.exists? + ques_status = 1 + question_answered += 1 + else + ques_status = 0 + end else - ques_status = 0 + if ques_vote.find_vote_text.first.present? + ques_status = 1 + question_answered += 1 + else + ques_status = 0 + end end + + # if ques_vote.present? + # ques_status = 1 + # question_answered += 1 + # else + # ques_status = 0 + # end answer_status = { :ques_id => q.id, :ques_number => q.question_number,