问卷的导出和统计结果调整

dev_daiao
cxt 5 years ago
parent 6d6925f537
commit d8a4b06ca3

@ -1409,8 +1409,8 @@ class PollsController < ApplicationController
poll_questions.each do |q|
user_poll_votes = u_user.poll_votes.find_current_vote("poll_question_id",q.id)
if user_poll_votes.present?
if q.question_type < 3
user_poll_answer_ids = user_poll_votes.pluck(:poll_answer_id).reject(&:blank?)
user_poll_vote_texts = user_poll_votes.pluck(:vote_text).reject(&:blank?)
if user_poll_answer_ids.count > 0
answer_content = q.poll_answers.find_answer_by_custom("id",user_poll_answer_ids)
if user_poll_answer_ids.count >1
@ -1418,7 +1418,12 @@ class PollsController < ApplicationController
else
u_answer = answer_content.first&.answer_text
end
elsif user_poll_vote_texts.count > 0
else
u_answer = "--"
end
else
user_poll_vote_texts = user_poll_votes.pluck(:vote_text).reject(&:blank?)
if user_poll_vote_texts.count > 0
if user_poll_vote_texts.count > 1
u_answer = user_poll_vote_texts.join(";")
else
@ -1427,6 +1432,7 @@ class PollsController < ApplicationController
else
u_answer = "--"
end
end
else
u_answer = "--"
end

@ -21,7 +21,5 @@ json.question do
json.answer_percent question_vote_user.present? ? (answer_users_count.to_f / question_vote_user.to_f).round(3) : 0.0
end
end
if question_votes.find_vote_text.present?
json.vote_text question_votes.pluck(:vote_text).reject(&:blank?) #问题的回答是否有用户手动输入的内容
end
json.vote_text question_votes.find_vote_text.present? ? question_votes.pluck(:vote_text).reject(&:blank?) : "--" #问题的回答是否有用户手动输入的内容
end
Loading…
Cancel
Save