diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index b25dfa20..65be029c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -85,13 +85,18 @@ class StudentWorkController < ApplicationController @user_name = @work.user.show_real_name @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) myshixuns = @shixun.myshixuns.where(:user_id => student_works_user_id).includes(:games) # 课堂实训中,评测次数最大值 @total_evaluate_max = 0 - @user_evaluate_count = 0 # 为了取最小efficiency。最小值是一个不确定数 @min_efficiency = [] power = [] @@ -120,11 +125,6 @@ class StudentWorkController < ApplicationController 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 consume_time = format("%.2f", x_time).to_f