From f80ed2fb2f54a2dce94c429b97b94bcd97efc63e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 23 Aug 2019 15:28:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=B8=BB=E7=9B=AE=E5=BD=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/homework_common.rb | 5 +++++ .../_homework_public_navigation.json.jbuilder | 1 + 2 files changed, 6 insertions(+) diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 332aff045..790a9b7ab 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -80,6 +80,11 @@ class HomeworkCommon < ApplicationRecord end end + # 实训作业的主目录信息 + def main_category_info + {category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name)} + end + # 根据是否统一发布获取作业的作品列表 def all_works student_works = self.unified_setting ? self.student_works : diff --git a/app/views/homework_commons/_homework_public_navigation.json.jbuilder b/app/views/homework_commons/_homework_public_navigation.json.jbuilder index 243c6aecd..b5067e3c7 100644 --- a/app/views/homework_commons/_homework_public_navigation.json.jbuilder +++ b/app/views/homework_commons/_homework_public_navigation.json.jbuilder @@ -2,6 +2,7 @@ json.course_id course.id json.course_name course.name json.is_end course.is_end json.category homework.category_info +json.main_category homework.main_category_info if homework.homework_type == "practice" member = course.course_members.find_by(user_id: user.id, is_active: 1) curr_status = homework_curr_status(homework, user.course_identity(course), course, member, member&.teacher_course_groups) json.homework_status curr_status[:status]