|
|
|
@ -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 = []
|
|
|
|
|