From a79528bbd88e6383eb7189dcfe8d34287b86e857 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 29 Jul 2019 14:39:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=92=E8=A1=8C=E6=A6=9C=E7=9A=84=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/competitions_controller.rb | 6 ++++-- app/views/competitions/charts.html.erb | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index 071cd200..29e14100 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -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| diff --git a/app/views/competitions/charts.html.erb b/app/views/competitions/charts.html.erb index 723f54e9..5fdbafff 100644 --- a/app/views/competitions/charts.html.erb +++ b/app/views/competitions/charts.html.erb @@ -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 %>
  • "><%= stage.name %>排行榜
  • <% end %>