From a40b9523f21baa08b3275a2bd831167e36c9ac20 Mon Sep 17 00:00:00 2001 From: rulingcom Date: Thu, 9 Jul 2026 16:39:46 +0800 Subject: [PATCH] resolve teacher role_id dynamically instead of hardcoding ObjectId --- lib/tasks/sync_nfu_personal_data_tasks.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/sync_nfu_personal_data_tasks.rake b/lib/tasks/sync_nfu_personal_data_tasks.rake index ed0b1a1..f456425 100644 --- a/lib/tasks/sync_nfu_personal_data_tasks.rake +++ b/lib/tasks/sync_nfu_personal_data_tasks.rake @@ -736,10 +736,10 @@ module NfuSyncPlugin def sync_teacher_attribute(member, config) # 比對或建立 attribute_field - role_id = BSON::ObjectId('6904852a4eae35f6d58a443f') - + teacher_role = Role.where(:'title.en' => /teacher/i).first + return unless teacher_role + role_id = teacher_role.id attribute_field = AttributeField.where(:role_id => role_id, 'title.zh_tw' => config[:title_zh_tw]).first - unless attribute_field # 自動建立 attribute_field attribute_field = AttributeField.new