fixed 竞赛导出报名表

This commit is contained in:
xxq250 2024-11-08 11:03:16 +08:00
parent dcb5f8884e
commit 7d2f293ac5
1 changed files with 4 additions and 1 deletions

View File

@ -147,6 +147,7 @@ class CompetitionInfosController < ApplicationController
enroll_fields = @competition_info.enroll_fields
enroll_fields = enroll_fields.delete_if { |key, value| ["sub_item", "works_name", "works_url"].include?(value) } if params[:upload].to_s != "true"
@table_columns = enroll_fields.keys
@table_columns = @table_columns + %w(参赛报名表下载链接)
@table_columns = @table_columns + %w(作品下载链接) if params[:upload].to_s == "true" && !enroll_fields.values.include?("works_url")
@table_columns = @table_columns + %w(申请表下载链接) if params[:apply_status].present?
@table_columns = @table_columns + %w(bm审查下载链接) if @competition_info.identifier == "KXSYSJ-2024"
@ -158,6 +159,8 @@ class CompetitionInfosController < ApplicationController
competition_users.each do |u|
info_array = []
file_array = []
file = Attachment.where_id_or_uuid(u.enroll_template_id).first
file_array = file_array + [file.blank? ? "" : "#{EduSetting.get('host_name')}/#{download_url(file)}"]
if params[:upload].to_s == "true" && !enroll_fields.values.include?("works_url")
file_array = file_array + [u.attachments.blank? ? "" : "#{EduSetting.get('host_name')}/#{download_url(u.attachments.first)}"]
end
@ -165,7 +168,7 @@ class CompetitionInfosController < ApplicationController
file = Attachment.where_id_or_uuid(u.ext2).first
file_array = file_array + [file.blank? ? "" : "#{EduSetting.get('host_name')}/#{download_url(file)}"]
end
if @competition_info.identifier == "KXSYSJ-2024"
if @competition_info.identifier == "KXSYSJ-2024" && params[:upload].to_s == "true"
file = Attachment.where_id_or_uuid(u.bm_file_id).first
file_array = file_array + [file.blank? ? "" : "#{EduSetting.get('host_name')}/#{download_url(file)}"]
end