作业子目录

PCqiandao
cxt 5 years ago
parent ab15b118ec
commit 1838923041

@ -69,17 +69,18 @@ class HomeworkCommon < ApplicationRecord
# 作业对应的子目录/父目录名称 # 作业对应的子目录/父目录名称
def category_info def category_info
case self.homework_type if self.course_second_category.present?
when 'normal' {category_id: self.course_second_category.try(:id), category_name: self.course_second_category.try(:name), main: 0}
{category_id: course.common_course_modules.first.try(:id), category_name: course.common_course_modules.first.try(:module_name), main: 1} else
when 'group' course_module = case homework_type
{category_id: course.group_course_modules.first.try(:id), category_name: course.group_course_modules.first.try(:module_name), main: 1} when 'normal'
when 'practice' course.common_course_modules.take
if self.course_second_category.present? when 'group'
{category_id: self.course_second_category.try(:id), category_name: self.course_second_category.try(:name), main: 0} course.group_course_modules.take
else when 'practice'
{category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name), main: 1} course.shixun_course_modules.take
end end
{category_id: course_module.try(:id), category_name: course_module.try(:module_name), main: 1}
end end
end end

Loading…
Cancel
Save