save year value by writing conference's period_start_date or year

This commit is contained in:
EricTYL 2019-10-18 13:52:23 +08:00
parent 9fb7b5f958
commit de2da3ee03
1 changed files with 5 additions and 1 deletions

View File

@ -106,6 +106,7 @@ def sync_conference_papers(query_result, user)
wc = WritingConference.new
apa_title = nil
invalid_apa_title = [nil, '', '必填欄位', '無', 'n/a', 'non']
invalid_values = [nil, '', '必填欄位', '無', 'n/a', 'non']
j_data['data'].each do |data|
case data['eifSn']
@ -125,7 +126,6 @@ def sync_conference_papers(query_result, user)
temp_date = Date.strptime(data['data'].first['v'], '%Y/%m/%d') rescue nil
if temp_date.nil?
wc.period_start_date = nil
wc.year = nil
else
wc.period_start_date = temp_date
wc.year = temp_date.year
@ -134,6 +134,10 @@ def sync_conference_papers(query_result, user)
wc.period_end_date = data['data'].first['v']
#when '20190109101534767' # 合著之國際學者姓名與機構
# wc.authors = data['data'].first['v']
when '20190109103134500' # 會議年份
if !invalid_values.include? data['data'].first['v']
wc.year = data['data'].first['v']
end
when '20140313173831962' # 完整引文內容
apa_title = data['data'].first['v']
else