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]