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