预赛排行榜

dev_aliyun
cxt 5 years ago
parent 6d23fd5504
commit fe65f6c102

@ -246,14 +246,14 @@ class CompetitionsController < ApplicationController
# 第一阶段的得分和耗时 # 第一阶段的得分和耗时
challenges_1 = Challenge.where(:shixun_id => shixun1_id) challenges_1 = Challenge.where(:shixun_id => shixun1_id)
challenge_rate1 = 0.5 challenge_rate1 = 0.5
result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1 result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1, 3
score1 = result1[0] score1 = result1[0]
time1 = result1[1] time1 = result1[1]
# 第二阶段的得分和耗时 # 第二阶段的得分和耗时
challenge_rate2 = 1.0 challenge_rate2 = 1.0
challenges_2 = Challenge.where(:shixun_id => shixun2_id) challenges_2 = Challenge.where(:shixun_id => shixun2_id)
result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2 result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2, 3
score2 = result2[0] score2 = result2[0]
time2 = result2[1] time2 = result2[1]
@ -346,15 +346,15 @@ class CompetitionsController < ApplicationController
user_ids = team.team_members.where(:is_teacher => 0).pluck(:user_id) user_ids = team.team_members.where(:is_teacher => 0).pluck(:user_id)
# 第一阶段的得分和耗时 # 第一阶段的得分和耗时
challenges_1 = Challenge.where(:shixun_id => shixun1_id) challenges_1 = Challenge.where(:shixun_id => shixun1_id)
challenge_rate1 = 0.5 challenge_rate1 = 1.0
result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1 result1 = chart_exp_score_pre user_ids, s1_time, e1_time, challenges_1, challenge_rate1, 2
score1 = result1[0] score1 = result1[0]
time1 = result1[1] time1 = result1[1]
# 第二阶段的得分和耗时 # 第二阶段的得分和耗时
challenge_rate2 = 1.0 challenge_rate2 = 1.0
challenges_2 = Challenge.where(:shixun_id => shixun2_id) challenges_2 = Challenge.where(:shixun_id => shixun2_id)
result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2 result2 = chart_exp_score_pre user_ids, s2_time, e2_time, challenges_2, challenge_rate2, 2
score2 = result2[0] score2 = result2[0]
time2 = result2[1] time2 = result2[1]
@ -741,11 +741,12 @@ class CompetitionsController < ApplicationController
# challenges 每阶段三个实训的所有关卡 # challenges 每阶段三个实训的所有关卡
# s_time 阶段开始时间 e_time 阶段结束时间 # s_time 阶段开始时间 e_time 阶段结束时间
# rate 关卡经验值与分数的比值 # rate 关卡经验值与分数的比值
# challenge_count 每个实训的关卡数
# 对三个实训的所有关卡循环: 找到在比赛时间内通关的最低耗时 # 对三个实训的所有关卡循环: 找到在比赛时间内通关的最低耗时
def chart_exp_score_pre user_ids, s_time, e_time, challenges, rate def chart_exp_score_pre user_ids, s_time, e_time, challenges, rate, challenge_count
total_score = 0 total_score = 0
total_time = 0 total_time = 0
length = challenges.size / 3 #每个实训的关卡数 length = challenge_count #每个实训的关卡数
for i in 1..length for i in 1..length
score = 0 score = 0
time = 0 time = 0

@ -1,4 +1,4 @@
<% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" %> <% if @competition.identifier == 'hn' || @competition.identifier == 'gcc-dev-2018' || @competition.identifier == "gcc-annotation-2018" || @competition.identifier == "gcc-task-2019" %>
<div class="competion-ranking"> <div class="competion-ranking">
<div class="ranking-nav edu-txt-center clearfix"> <div class="ranking-nav edu-txt-center clearfix">
<div class="inline"> <div class="inline">

Loading…
Cancel
Save