From 82b7df0d8b0463488a201fe741956135fac4aa5c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 23 May 2019 17:55:57 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 88123b23..1e3834d6 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -609,13 +609,15 @@ class StudentWorkController < ApplicationController @student_work_pages = Paginator.new @student_work_count, @limit, @page @offset ||= @student_work_pages.offset @stundet_works = paginateHelper @stundet_works, @limit - @stundet_works = if @homework.homework_type == 1 - @stundet_works.includes(:student_works_scores, [user: :user_extensions]) - elsif @homework.homework_type == 3 - @stundet_works.includes(:student_works_scores, [project: :project_score], [user: :user_extensions]) - elsif @homework.homework_type == 4 - @stundet_works.includes(:student_works_scores, [myshixun: :games], [user: :user_extensions]) - end + if @stundet_works.size != 0 + @stundet_works = if @homework.homework_type == 1 + @stundet_works.includes(:student_works_scores, [user: :user_extensions]) + elsif @homework.homework_type == 3 + @stundet_works.includes(:student_works_scores, [project: :project_score], [user: :user_extensions]) + elsif @homework.homework_type == 4 + @stundet_works.includes(:student_works_scores, [myshixun: :games], [user: :user_extensions]) + end + end @members = @course.members.where(user_id: @stundet_works.pluck(:user_id)).select([:user_id, :course_group_id]) respond_to do |format| format.js