diff --git a/app/views/files/index.json.jbuilder b/app/views/files/index.json.jbuilder index 67258daf5..6debc3757 100644 --- a/app/views/files/index.json.jbuilder +++ b/app/views/files/index.json.jbuilder @@ -17,10 +17,15 @@ json.data do end # json.partial! "files/course_groups", attachment_group_settings: attachment.attachment_group_settings json.category_id attachment.course_second_category_id - if (@course_second_category_id.to_i == 0 && attachment.course_second_category.present?) || (@parent_category_id == 0 && attachment.course_second_category&.parent_id.to_i != 0) + if @course_second_category_id.to_i == 0 && attachment.course_second_category.present? json.category_name attachment.course_second_category&.name json.parent_category_name attachment.course_second_category&.parent&.name end + + if @parent_category_id == 0 && attachment.course_second_category&.parent_id.to_i != 0 + json.category_name attachment.course_second_category&.name + json.parent_category_name nil + end end end end