From 40979e7b2cbe6c391c0e33c5c3495b7d194918cf Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Tue, 25 Jun 2019 15:52:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=AE=9E=E8=AE=AD=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E8=AF=84=E6=B5=8B=E6=AC=A1=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_works_controller.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/controllers/student_works_controller.rb b/app/controllers/student_works_controller.rb index 0002a49ea..7e23443d2 100644 --- a/app/controllers/student_works_controller.rb +++ b/app/controllers/student_works_controller.rb @@ -429,13 +429,17 @@ class StudentWorksController < ApplicationController def shixun_work_report @user = @work.user @shixun = @homework.shixuns.take - @games = @work.myshixun.games.includes(:challenge, :game_codes, :outputs) if @work.myshixun + # 提示: 这里如果includes outputs表的话: sum(:evaluate_count)会出现错误 + @games = @work.myshixun.games if @work.myshixun # 用户最大评测次数 - logger.info("-----------#{@games.map(&:evaluate_count)}") - logger.info("-------sum_evaluate_count----#{@games.sum(:evaluate_count)}") - logger.info("-------sum_evaluate_count----#{@games.sum("games.evaluate_count")}") - @user_evaluate_count = @games.sum(:evaluate_count) if @games + if @games + @user_evaluate_count = @games.sum(:evaluate_count) + @games = @games.includes(:challenge, :game_codes, :outputs) + else + @user_evaluate_count = 0 + end + # 图形效率图的数据 @echart_data = student_efficiency(@homework, @work) end