Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_course
daiao 5 years ago
commit ee1f28eb52

@ -925,7 +925,6 @@ class PollsController < ApplicationController
@page = params[:page] || 1
@limit = params[:limit] || 10
@poll_export_questions = @poll_questions
logger.info("################____________________#{@poll_questions.pluck(:id)}")
@poll_questions = @poll_questions.page(@page).per(@limit)
if params[:format] == "xlsx"
@ -939,12 +938,6 @@ class PollsController < ApplicationController
polls_export_name = "#{current_user.real_name}_#{@course.name}_#{@poll.polls_name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}"
polls_user_commit = poll_commit_result(@poll,@poll_export_questions,@poll_users,@poll_commit_ids)
render xlsx: "#{polls_export_name.strip.first(30)}",template: "polls/commit_result.xlsx.axlsx",locals: {polls_user_commit:polls_user_commit}
# render xlsx: "#{polls_export_name.strip.first(30)}",template: "polls/commit_result.xlsx.axlsx",locals: {
# poll_questions:@poll_export_questions,
# poll:@poll,
# poll_users: @poll_users,
# poll_commit_ids:@poll_commit_ids}
}
end
end

@ -7,13 +7,13 @@ wb.styles do |s|
wb.add_worksheet(:name => "统计结果") do |sheet|
sheet.sheet_view.show_grid_lines = false
obj_commit = polls_user_commit[:obj_commit]
sub_commit = polls_user_commit[:sub_commit]
poll_user_info = polls_user_commit[:poll_users_info]
user_commit = polls_user_commit[:user_commit]
obj_commit = polls_user_commit[:obj_commit] || []
sub_commit = polls_user_commit[:sub_commit] || []
poll_user_info = polls_user_commit[:poll_users_info] || []
user_commit = polls_user_commit[:user_commit] || []
#客观题的导出
if obj_commit.size > 0
if obj_commit&.size > 0
obj_commit.each do |obj|
sheet.add_row obj[:sheet_row], :height =>15,:style => blue_cell
sheet.add_row obj[:sheet_answer_row], :height =>15, :style => sz_all
@ -24,7 +24,7 @@ wb.styles do |s|
end
#主观题的导出
if sub_commit.size > 0
if sub_commit&.size > 0
sub_commit.each do |sub|
main_sub_title = sub[:sub_tile]
main_sub_content = sub[:sub_user_votes]
@ -38,7 +38,7 @@ wb.styles do |s|
sheet.add_row poll_user_info, :height =>15, :style => blue_cell
if user_commit.size > 0
if user_commit&.size > 0
user_commit.each do |com|
sheet.add_row com, :height =>15,:style => sz_all
end

Loading…
Cancel
Save