Add filter valid date for teacher.
This commit is contained in:
parent
92c46ae69c
commit
b24b156abd
|
@ -593,7 +593,15 @@ module NccuSyncPlugin
|
|||
end
|
||||
|
||||
def self.get_sta_num_to_nccu_id_mapping #sta_num 與 nccu_id 的對照表, 可透過 rss_aaldap_view 與 rss_pautlst_view 這兩個table查詢
|
||||
@sta_num_to_nccu_id_mapping = query_db('rss_aaldap_view').map{|h| [h['sta_num'], h['nccu_id']]}.to_h # psn_nam 教師完整姓名
|
||||
@sta_num_to_reli_dt_mapping = {}
|
||||
@sta_num_to_nccu_id_mapping = {}
|
||||
query_db('rss_pautlst_view').each do |h|
|
||||
# psn_nam 教師完整姓名
|
||||
sta_num = h['sta_num']
|
||||
reli_dt = h['reli_dt']
|
||||
@sta_num_to_reli_dt_mapping[sta_num] = (reli_dt.blank? ? nil : Date.parse(reli_dt)) # 到期日 (NULL 或 空 代表沒有期限)
|
||||
@sta_num_to_nccu_id_mapping[sta_num] = h['nccu_id']
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_journal_papers(staff_id)
|
||||
|
@ -741,8 +749,14 @@ namespace :sync_nccu_personal_plugins do
|
|||
else
|
||||
mps = MemberProfile.all.to_a
|
||||
end
|
||||
today = Date.today
|
||||
@sta_num_to_reli_dt_mapping = NccuSyncPlugin.instance_variable_get(:@sta_num_to_reli_dt_mapping)
|
||||
mps.each do |mp|
|
||||
staff_id = mp.sid rescue nil
|
||||
reli_dt = @sta_num_to_reli_dt_mapping[staff_id]
|
||||
if reli_dt && reli_dt < today
|
||||
next
|
||||
end
|
||||
if (!staff_id.blank? rescue false)
|
||||
NccuSyncPlugin.sync_journal_papers(staff_id,mp)
|
||||
NccuSyncPlugin.sync_conference_papers(staff_id,mp)
|
||||
|
|
Loading…
Reference in New Issue