导出成绩调整

dev_home
cxt 6 years ago
parent f21da8bf87
commit 621b93ecb6

@ -123,19 +123,19 @@ class Competitions::CompetitionsController < Competitions::BaseController
@stage = @competition.competition_stages.take
end
@records = @competition.competition_teams.joins(:competition_scores).where(competition_scores: {competition_stage_id: @stage&.id.to_i})
@all_records = @competition.competition_teams.joins(:competition_scores).where(competition_scores: {competition_stage_id: @stage&.id.to_i})
.select("competition_teams.*, score, cost_time").order("score desc, cost_time desc")
current_team_ids = @competition.team_members.where(user_id: current_user.id).pluck(:competition_team_id).uniq
@user_ranks = @records.select{|com_team| current_team_ids.include?(com_team.id)}
@records = @records.where("score > 0")
@records = @all_records.where("score > 0")
@record_ids = @records.pluck(:id)
if params[:format] == "xlsx"
@records = @records.includes(user: [user_extension: :school], team_members: :user)
respond_to do |format|
format.xlsx{
set_export_cookies
chart_to_xlsx(@records, @competition)
chart_to_xlsx(@all_records, @competition)
exercise_export_name = "#{@competition.name}比赛成绩"
render xlsx: "#{exercise_export_name.strip}",template: "competitions/competitions/chart_list.xlsx.axlsx",locals:
{table_columns: @competition_head_cells, chart_lists: @competition_cells_column}

@ -14,9 +14,9 @@ wb.add_worksheet(name: '报名列表') do |sheet|
@personal ? "--" : team.teachers_info,
member_user.real_name,
member_user.identity,
member_user.phone,
member_user.phone.present? ? (member_user.phone.to_s + "\t") : "--",
member_user.mail,
member_user.student_id,
member_user.student_id.present? ? (member_user.student_id.to_s + "\t") : "--",
member_user.authentication ? "√" : "",
member_user.professional_certification ? "√" : "",
member_user.school_name,

Loading…
Cancel
Save