Merge remote-tracking branch 'origin/develop' into develop

dev_home
杨树明 5 years ago
commit 197d403ea9

@ -123,19 +123,19 @@ class Competitions::CompetitionsController < Competitions::BaseController
@stage = @competition.competition_stages.take @stage = @competition.competition_stages.take
end 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") .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 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)} @user_ranks = @all_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) @record_ids = @records.pluck(:id)
if params[:format] == "xlsx" if params[:format] == "xlsx"
@records = @records.includes(user: [user_extension: :school], team_members: :user) @records = @records.includes(user: [user_extension: :school], team_members: :user)
respond_to do |format| respond_to do |format|
format.xlsx{ format.xlsx{
set_export_cookies set_export_cookies
chart_to_xlsx(@records, @competition) chart_to_xlsx(@all_records, @competition)
exercise_export_name = "#{@competition.name}比赛成绩" exercise_export_name = "#{@competition.name}比赛成绩"
render xlsx: "#{exercise_export_name.strip}",template: "competitions/competitions/chart_list.xlsx.axlsx",locals: render xlsx: "#{exercise_export_name.strip}",template: "competitions/competitions/chart_list.xlsx.axlsx",locals:
{table_columns: @competition_head_cells, chart_lists: @competition_cells_column} {table_columns: @competition_head_cells, chart_lists: @competition_cells_column}

@ -14,7 +14,7 @@
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">图片</span> <span class="input-group-text">图片</span>
</div> </div>
<div class="custom-file flex-row-reverse"> <div class="custom-file flex-row-reverse" style="overflow: hidden">
<input type="file" name="portal_image[image]" class="img-file-input" id="img-file-input" accept="image/*"> <input type="file" name="portal_image[image]" class="img-file-input" id="img-file-input" accept="image/*">
<label class="custom-file-label file-names" for="img-file-input">选择文件</label> <label class="custom-file-label file-names" for="img-file-input">选择文件</label>
</div> </div>

@ -14,14 +14,14 @@ wb.add_worksheet(name: '报名列表') do |sheet|
@personal ? "--" : team.teachers_info, @personal ? "--" : team.teachers_info,
member_user.real_name, member_user.real_name,
member_user.identity, member_user.identity,
member_user.phone, member_user.phone.present? ? (member_user.phone.to_s + "\t") : "--",
member_user.mail, member_user.mail,
member_user.student_id, member_user.student_id.present? ? (member_user.student_id.to_s + "\t") : "--",
member_user.authentication ? "√" : "", member_user.authentication ? "√" : "",
member_user.professional_certification ? "√" : "", member_user.professional_certification ? "√" : "",
member_user.school_name, member_user.school_name,
member_user.school_province, member_user.school_province,
member.created_at.strftime('%Y-%m-%d %H:%M'), team.created_at&.strftime('%Y-%m-%d %H:%M'),
rank rank
] ]
sheet.add_row(data) sheet.add_row(data)

Loading…
Cancel
Save