diff --git a/app/controllers/competitions_controller.rb b/app/controllers/competitions_controller.rb index 3b438e06..4cbb8d14 100644 --- a/app/controllers/competitions_controller.rb +++ b/app/controllers/competitions_controller.rb @@ -749,7 +749,7 @@ class CompetitionsController < ApplicationController # rate 关卡经验值与分数的比值 # challenge_count 每个实训的关卡数 # 对三个实训的所有关卡循环: 找到在比赛时间内通关的最低耗时 - def chart_exp_score_pre user_ids, s_time, e_time, challenges, rate, challenge_count + def chart_exp_score_pre user_ids, s_time, e_time, challenges, s_rate, challenge_count total_score = 0 total_time = 0 length = challenge_count #每个实训的关卡数 @@ -758,7 +758,7 @@ class CompetitionsController < ApplicationController time = 0 challenges.where(:position => i).each do |challenge| Game.where(:challenge_id => challenge.id, :user_id => user_ids, :status => 2).select{|game| game.open_time >= s_time && game.end_time <= e_time }.each do |game| - game_score = challenge.score * rate + game_score = challenge.score * s_rate cost_time = (game.end_time.to_i - s_time.to_i) > 0 ? (game.end_time.to_i - s_time.to_i) : 0 if score < game_score score = game_score