resolve teacher role_id dynamically instead of hardcoding ObjectId
This commit is contained in:
parent
d28599d3d0
commit
a40b9523f2
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue