|
|
@ -749,7 +749,7 @@ class CompetitionsController < ApplicationController
|
|
|
|
# rate 关卡经验值与分数的比值
|
|
|
|
# rate 关卡经验值与分数的比值
|
|
|
|
# challenge_count 每个实训的关卡数
|
|
|
|
# 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_score = 0
|
|
|
|
total_time = 0
|
|
|
|
total_time = 0
|
|
|
|
length = challenge_count #每个实训的关卡数
|
|
|
|
length = challenge_count #每个实训的关卡数
|
|
|
@ -758,7 +758,7 @@ class CompetitionsController < ApplicationController
|
|
|
|
time = 0
|
|
|
|
time = 0
|
|
|
|
challenges.where(:position => i).each do |challenge|
|
|
|
|
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.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
|
|
|
|
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
|
|
|
|
if score < game_score
|
|
|
|
score = game_score
|
|
|
|
score = game_score
|
|
|
|