resolve teacher role_id dynamically instead of hardcoding ObjectId

This commit is contained in:
rulingcom 2026-07-09 16:39:46 +08:00
parent d28599d3d0
commit a40b9523f2
1 changed files with 3 additions and 3 deletions

View File

@ -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