排行榜的导出

dev_aliyun
cxt 5 years ago
parent bc9e92402c
commit a79528bbd8

@ -452,8 +452,10 @@ class CompetitionsController < ApplicationController
sheet1[count_row,11] = com_spend_time user[:s_spend_time].to_i
count_row += 1
end
elsif @competition.identifier == "gcc-dev-2018"
elsif @competition.identifier == "gcc-dev-2018" || @competition.identifier == "gcc-task-2019"
records = @competition.competition_teams
f_rate = @competition.identifier == "gcc-dev-2018" ? 0.85 : 0.8
p_rate = @competition.identifier == "gcc-dev-2018" ? 0.15 : 0.2
records.each do |team|
# 决赛记录
f_score = team.competition_scores.where(:competition_stage_id => @competition.competition_stages.where(:name => "决赛").first.try(:id)).first
@ -463,7 +465,7 @@ class CompetitionsController < ApplicationController
team[:p_time] = p_score.try(:cost_time)
team[:f_score] = f_score.try(:score)
team[:f_time] = f_score.try(:cost_time)
team[:s_score] = (f_score.try(:score).to_f * 0.85 + p_score.try(:score).to_f * 0.15).try(:round, 2)
team[:s_score] = (f_score.try(:score).to_f * f_rate + p_score.try(:score).to_f * p_rate).try(:round, 2)
team[:s_spend_time] = f_score.try(:cost_time).to_i + p_score.try(:cost_time).to_i
end
records = records.sort do |a, b|

@ -13,7 +13,7 @@
<% end %>
<% @max_min_stage.reverse.each do |section| %>
<% stage = section.competition_stage %>
<% if stage.name != "模拟赛" %>
<% if stage.name != "模拟赛" && !stage.name.blank? %>
<% if section.min_start_time < Time.now %>
<li class="<%= @type == stage.name ? "active" : "" %>"><a href="<%= charts_competition_path(@competition, :stage_id => stage.id) %>" data-remote="true"><%= stage.name %>排行榜</a></li>
<% end %>

Loading…
Cancel
Save