From d6be63011f7cb45b5e9b7c808f03d060fdfe88f5 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 25 Jul 2019 18:59:18 +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/courses_helper.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index fa51de6b7..8c2aeb479 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -199,7 +199,8 @@ module CoursesHelper # 获取课堂的作业数 def get_homework_commons_count(course, type, category_id) - HomeworkCommon.where(course_id: course.id, homework_type: type, course_second_category_id: category_id).size + category_id == 0 ? HomeworkCommon.where(course_id: course.id, homework_type: type).size : + HomeworkCommon.where(course_id: course.id, homework_type: type, course_second_category_id: category_id).size end