Merge branch 'dev_aliyun' into educoder

dev_aliyun
daiao 5 years ago
commit 8fac4d57b9

@ -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

@ -22,7 +22,7 @@
<% @records.each do |record| %> <% @records.each do |record| %>
<% <%
course = record.snapshot['course'] course = record.snapshot['course']
total_members_count += record.snapshot['members_count'].to_i total_members_count += course.students.count
total_shixun_homework_count += record.snapshot['shixun_homework_count'].to_i total_shixun_homework_count += record.snapshot['shixun_homework_count'].to_i
total_valid_homework_count += record.snapshot['valid_myshixun_count'].to_i total_valid_homework_count += record.snapshot['valid_myshixun_count'].to_i
total_course_score += record.score.to_i total_course_score += record.score.to_i
@ -34,7 +34,7 @@
<span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span>
<% end %> <% end %>
</td> </td>
<td width="10%"><%= record.snapshot['members_count'].to_i %></td> <td width="10%"><%= course.students.count %></td>
<td width="15%"><%= record.snapshot['shixun_homework_count'].to_i || '--' %></td> <td width="15%"><%= record.snapshot['shixun_homework_count'].to_i || '--' %></td>
<td width="10%"><%= record.snapshot['valid_myshixun_count'].to_i %></td> <td width="10%"><%= record.snapshot['valid_myshixun_count'].to_i %></td>
<td width="15%"><%= record.score.to_i.zero? ? '--' : record.score.to_i %></td> <td width="15%"><%= record.score.to_i.zero? ? '--' : record.score.to_i %></td>
@ -67,7 +67,7 @@
<span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span> <span class="task-hide fl" style="max-width: 480px;"><%= course.name %></span>
<% end %> <% end %>
</td> </td>
<td width="10%"><%= course.members_count %></td> <td width="10%"><%= course.students.count %></td>
<td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td> <td width="15%"><%= course['shixun_homework_count'].presence || '--' %></td>
<td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td> <td width="10%"><%= @course_myshixun_map.fetch(course.id, '--') %></td>
<td width="15%"><%= score.zero? ? '--' : score %></td> <td width="15%"><%= score.zero? ? '--' : score %></td>

Loading…
Cancel
Save