From a404745774be724a098f5e8b27a7676c68bc0cc0 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 18 Mar 2020 09:52:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=8C=E7=BA=A7=E7=9B=AE=E5=BD=95=E7=9A=84?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/files/index.json.jbuilder | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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