Update fgu_sync.rake.

This commit is contained in:
邱博亞 2023-12-18 00:04:28 +08:00
parent 9e937f6ca5
commit c1483b27bf
1 changed files with 3 additions and 3 deletions

View File

@ -74,7 +74,7 @@ namespace :fgu_sync do
jp = JournalPaper.where(:rss2_id => rss2id).first rescue nil
jp_data = {
:publication_date => pd, :rss2_id => rss2id, :year => pd.strftime("%Y"),
:publication_date => pd, :rss2_id => rss2id, :year => (pd ? pd.strftime("%Y") : ""),
:authors_translations => authors, :paper_title_translations => paper_title,
:journal_title_translations => journal_title, :vol_no => dt["vol_no"], :issue_no => dt["issue_no"],
:note => note, :form_to_start => from_to[0], :form_to_end => from_to[1]
@ -121,7 +121,7 @@ namespace :fgu_sync do
note = dt["department"] + " " + dt["note"]
cp = WritingConference.where(:rss2_id => rss2id).first rescue nil
cp_data = {:period_start_date => start_date, :period_end_date => end_date, :rss2_id => rss2id, :year => end_date.strftime("%Y"), :authors_translations => authors, :paper_title_translations => paper_title, :conference_title_translations => conference_title, :note => note, :location_translations => {"en" => dt["location"], "zh_tw" => dt["location"]}}
cp_data = {:period_start_date => start_date, :period_end_date => end_date, :rss2_id => rss2id, :year => (end_date ? end_date.strftime("%Y") : ""), :authors_translations => authors, :paper_title_translations => paper_title, :conference_title_translations => conference_title, :note => note, :location_translations => {"en" => dt["location"], "zh_tw" => dt["location"]}}
if cp.nil?
cp = WritingConference.new(cp_data)
puts "Saving new conference."
@ -174,7 +174,7 @@ namespace :fgu_sync do
end
book = Book.where(:rss2_id => rss2id).first rescue nil
book_data = {:publish_date => pd, :rss2_id => rss2id, :year => pd.strftime("%Y"), :authors_translations => authors, :publisher_translations => publisher, :book_title_translations => book_title, :isbn => dt["isbn"], :note => note, :language => dt["language"], :member_profile => mp}
book_data = {:publish_date => pd, :rss2_id => rss2id, :year => (pd ? pd.strftime("%Y") : ""), :authors_translations => authors, :publisher_translations => publisher, :book_title_translations => book_title, :isbn => dt["isbn"], :note => note, :language => dt["language"], :member_profile => mp}
if book.nil?
book = Book.new(book_data)
puts "Saving new book."