project_pack
hjm 6 years ago
commit b1e1e39581

@ -1066,8 +1066,9 @@ class AccountController < ApplicationController
# end # end
elsif !User.current.user_extensions.school.nil? elsif !User.current.user_extensions.school.nil?
@tip = "申请已提交我们将在5分钟内完成审核" @tip = "申请已提交我们将在5分钟内完成审核"
unless apply_action.present? if !apply_action.present?
ApplyAction.create(:user_id => User.current.id, :status => 0, :ip_addr => request.remote_ip, :container_type => "TrialAuthorization", :apply_reason => params[:apply_reason]) ApplyAction.create(:user_id => User.current.id, :status => 0, :ip_addr => request.remote_ip, :container_type => "TrialAuthorization", :apply_reason => params[:apply_reason])
if user_ex.identity == 0 || user_ex.identity == 2
begin begin
status = Trustie::Sms.send(mobile:17680641960, send_type:'user_apply_auth',name:'管理员' ) status = Trustie::Sms.send(mobile:17680641960, send_type:'user_apply_auth',name:'管理员' )
rescue => e rescue => e
@ -1075,6 +1076,7 @@ class AccountController < ApplicationController
end end
end end
end end
end
if params[:from_user] && params[:from_user] == '1' if params[:from_user] && params[:from_user] == '1'
@url = "#{user_path(User.current)}" @url = "#{user_path(User.current)}"
else else

@ -792,7 +792,7 @@ class ShixunsController < ApplicationController
shixun_script = modify_shixun_script @shixun, shixun_script shixun_script = modify_shixun_script @shixun, shixun_script
end end
end end
#@shixun.evaluate_script = shixun_script @shixun.evaluate_script = shixun_script
ActiveRecord::Base.transaction do ActiveRecord::Base.transaction do
begin begin

@ -85,12 +85,18 @@ class StudentWorkController < ApplicationController
@user_name = @work.user.show_real_name @user_name = @work.user.show_real_name
@student_id = @work.user.user_extensions.try(:student_id).nil? ? '--' : @work.user.user_extensions.try(:student_id) @student_id = @work.user.user_extensions.try(:student_id).nil? ? '--' : @work.user.user_extensions.try(:student_id)
# 当前用户评测最大次数
@user_evaluate_count = 0
if @myshixun.user_id == @work.user.id
@user_evaluate_count = @myshixun.games.pluck(:evaluate_count).sum.to_i
end
unless params[:pdf]
student_works_user_id = StudentWork.where(:homework_common_id => @homework.id).pluck(:user_id) student_works_user_id = StudentWork.where(:homework_common_id => @homework.id).pluck(:user_id)
myshixuns = @shixun.myshixuns.where(:user_id => student_works_user_id).includes(games: [:outputs]) myshixuns = @shixun.myshixuns.where(:user_id => student_works_user_id).includes(:games)
# 课堂实训中,评测次数最大值 # 课堂实训中,评测次数最大值
@total_evaluate_max = 0 @total_evaluate_max = 0
@user_evaluate_count = 0
# 为了取最小efficiency。最小值是一个不确定数 # 为了取最小efficiency。最小值是一个不确定数
@min_efficiency = [] @min_efficiency = []
power = [] power = []
@ -106,7 +112,7 @@ class StudentWorkController < ApplicationController
eff_score = 0 eff_score = 0
myshixun.games.each do |game| myshixun.games.each do |game|
evaluate_count += game.outputs.first.try(:query_index).to_i # 评测次数 evaluate_count += game.evaluate_count.to_i # 评测次数
# y_score = (evaluate_count == 0 ? 0 : (user_total_score / evaluate_count.to_f)) # y_score = (evaluate_count == 0 ? 0 : (user_total_score / evaluate_count.to_f))
# eff_score = format("%.2f", y_score).to_f # eff_score = format("%.2f", y_score).to_f
if game.status == 2 if game.status == 2
@ -115,15 +121,10 @@ class StudentWorkController < ApplicationController
all_time += (game.cost_time / 60.0).to_f all_time += (game.cost_time / 60.0).to_f
user_total_score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0 user_total_score += game.status == 2 ? game.final_score.to_i < 0 ? 0 : game.challenge.score.to_i : 0
if myshixun.user_id == @work.user.id if myshixun.user_id == @work.user.id
@game_user_query << [game.id, game.outputs.first.try(:query_index).to_i] @game_user_query << [game.id, game.evaluate_count.to_i]
end end
end end
# 当前用户评测最大次数
if myshixun.user_id == @work.user.id
@user_evaluate_count = evaluate_count
end
x_time = (all_time <= 1) ? 1 : Math.log(all_time).to_f x_time = (all_time <= 1) ? 1 : Math.log(all_time).to_f
consume_time = format("%.2f", x_time).to_f consume_time = format("%.2f", x_time).to_f
@ -163,6 +164,7 @@ class StudentWorkController < ApplicationController
result_list.sort{|x, y| x[:consume_time] <=> y[:consume_time]}.each do |result| result_list.sort{|x, y| x[:consume_time] <=> y[:consume_time]}.each do |result|
@power << [result[:consume_time], result[:eff_score], result[:round_size], result[:user_id]] @power << [result[:consume_time], result[:eff_score], result[:round_size], result[:user_id]]
end end
end
# @power = [] # @power = []

@ -7,7 +7,7 @@
<!-- <span class="fl mr5 ml3">/</span>--> <!-- <span class="fl mr5 ml3">/</span>-->
<%= link_to @shixun.name, shixun_path(@shixun), :class => "edu-info-dark fl task-hide",:style=>"max-width:300px", :target => "_blank" %> <%= link_to @shixun.name, shixun_path(@shixun), :class => "edu-info-dark fl task-hide",:style=>"max-width:300px", :target => "_blank" %>
</p> </p>
<% if User.current.has_teacher_role(@homework.course) || User.current.admin? || @work.user == User.current %> <% if User.current.has_teacher_role(@homework.course) || User.current.admin? || User.current.business? || @work.user == User.current %>
<div class="fl mt5 ml10" data-tip-down="实战中获得的总经验值"> <div class="fl mt5 ml10" data-tip-down="实战中获得的总经验值">
<span class="color-green">经验值:<%= @myshixun.total_score %> </span> <span class="color-green">经验值:<%= @myshixun.total_score %> </span>
</div> </div>

@ -77,8 +77,8 @@
<% end %> <% end %>
</td> </td>
<td><%= game.try(:open_time).nil? || game.status == 3 ? "--" : format_time(game.open_time) %></td> <td><%= game.try(:open_time).nil? || game.status == 3 ? "--" : format_time(game.open_time) %></td>
<% user_query = @game_user_query.select{|user_query| user_query[0] == game.id} %> <%# user_query = @game_user_query.select{|user_query| user_query[0] == game.id} %>
<td><%= user_query.blank? ? "--" : user_query.first[1] %></td> <td><%= game.evaluate_count.to_i == 0 ? "--" : game.evaluate_count.to_i %></td>
<td><%= game.try(:end_time).nil? ? "--" : format_time(game.end_time) %></td> <td><%= game.try(:end_time).nil? ? "--" : format_time(game.end_time) %></td>
<td><%= game.consumes_time %></td> <td><%= game.consumes_time %></td>
<td><%= game.status == 2 ? (game.final_score.to_i < 0 ? 0 : game.challenge.choose_score.to_i) : 0 %> / <%= game.challenge.choose_score %></td> <td><%= game.status == 2 ? (game.final_score.to_i < 0 ? 0 : game.challenge.choose_score.to_i) : 0 %> / <%= game.challenge.choose_score %></td>

Loading…
Cancel
Save