From 34a2e2a436e738560a3ef7bd9465f93021a2633c Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sun, 30 Jun 2019 10:43:07 +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/helpers/application_helper.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5370e310..753746e5 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -6602,7 +6602,7 @@ def update_shixun_work_status homework myshixuns.each do |myshixun| work = student_works.where(:user_id => myshixun.user_id).first member = homework.course.members.find_by_user_id(work.user_id) - setting_time = homework_group_setting homework, member.try(:course_group_id) + setting_time = homework_group_setting homework, member.try(:course_group_id).to_i games = myshixun.games.where(:challenge_id => challeng_ids) myshixun_endtime = games.select{|game| game.status == 2}.size == games.size ? games.map(&:end_time).max : nil compelete_status = 0 @@ -7254,11 +7254,9 @@ end # 作业的分班设置时间 def homework_group_setting homework, group_id - setting = nil - if homework.homework_group_settings.where(:course_group_id => group_id).first + setting = homework + if homework.homework_group_settings.where(:course_group_id => group_id).first.present? setting = homework.homework_group_settings.where(:course_group_id => group_id).first - else - setting = homework end setting end