导出增加每个学生的提交结果

This commit is contained in:
sw 2015-06-15 15:06:58 +08:00
parent 790e1741ab
commit e6b82e5463
1 changed files with 18 additions and 0 deletions

View File

@ -483,6 +483,24 @@ class PollController < ApplicationController
count_row += 1
end
end
sheet1.row(count_row).default_format = blue
sheet1[count_row ,0] = l(:label_bidding_user_studentname)
poll_questions.each_with_index do |poll_question, i|
sheet1[count_row ,i + 1] = poll_question.question_title
end
count_row += 1
@poll.users.each do |user|
sheet1[count_row ,0] = user.show_name
poll_questions.each_with_index do |poll_question, i|
if poll_question.question_type == 1 || poll_question.question_type == 2
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.poll_answer.answer_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ") if poll_vote.poll_answer}.join(";")
else
sheet1[count_row ,i + 1] = user.poll_votes.where(:poll_question_id => poll_question.id).map{|poll_vote| poll_vote.vote_text.gsub(/<\/?.*?>/,"").gsub(/&nbsp;/," ")}.join(";")
end
end
count_row += 1
end
book.write xls_report
xls_report.string
end