Merge branch 'educoder' into develop

project_pack
cxt 5 years ago
commit 67363893f8

@ -1066,8 +1066,9 @@ class AccountController < ApplicationController
# end
elsif !User.current.user_extensions.school.nil?
@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])
if user_ex.identity == 0 || user_ex.identity == 2
begin
status = Trustie::Sms.send(mobile:17680641960, send_type:'user_apply_auth',name:'管理员' )
rescue => e
@ -1075,6 +1076,7 @@ class AccountController < ApplicationController
end
end
end
end
if params[:from_user] && params[:from_user] == '1'
@url = "#{user_path(User.current)}"
else

@ -79,14 +79,15 @@ class StudentWorkController < ApplicationController
@shixun = Shixun.select([:id, :gpid, :name]).find(HomeworkCommonsShixuns.where(:homework_common_id => @homework.id).pluck(:shixun_id).first)
@challenges = Challenge.select([:id]).where(:shixun_id => @shixun.id)
@myshixun = @work.myshixun
@games = Game.where(:myshixun_id => @myshixun.id).includes(:challenge, :game_codes,:outputs).reorder("challenges.position") # 页面循环需要outputs
@games = Game.where(:myshixun_id => @myshixun.id).includes(:challenge, :game_codes, :outputs).reorder("challenges.position") # 页面循环需要outputs
# 用户个人信息
@user_name = @work.user.show_real_name
@student_id = @work.user.user_extensions.try(:student_id).nil? ? '--' : @work.user.user_extensions.try(:student_id)
unless params[:pdf]
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
@ -106,7 +107,7 @@ class StudentWorkController < ApplicationController
eff_score = 0
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))
# eff_score = format("%.2f", y_score).to_f
if game.status == 2
@ -115,7 +116,7 @@ class StudentWorkController < ApplicationController
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
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
@ -163,6 +164,7 @@ class StudentWorkController < ApplicationController
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]]
end
end
# @power = []

Loading…
Cancel
Save