Fix bug.
This commit is contained in:
parent
47eafeef14
commit
5fd1ad909f
|
@ -334,6 +334,7 @@ module FguSyncPlugin
|
|||
puts "Data found."
|
||||
puts "Deleting old data"
|
||||
Honor.where(:member_profile_id => mp.id, :rss2_id.nin => ([nil,''] + data.map{|dt| dt["rss2_id"]})).destroy
|
||||
Honor.where(:member_profile_id => mp.id, :award_name.in => data.map{|dt| dt["award_name"]}.select{|s| s.present?}).destroy
|
||||
data.each_with_index do |dt, idx|
|
||||
rss2_id = dt["rss2_id"]
|
||||
award_date = self.parse_date(dt["award_date"])
|
||||
|
@ -351,7 +352,7 @@ module FguSyncPlugin
|
|||
end
|
||||
end
|
||||
hon = Honor.where(:rss2_id => rss2_id).first
|
||||
hon_data = {:award_date => award_date, :award_name_translations=> award_name_translations, :country_translations => country_translations, :ranking_translations => ranking_translations, :awarding_body_translations => awarding_body_translations, :awarding_unit_translations => awarding_unit_translations, :year => year, :member_profile => mp, :honor_type => type}
|
||||
hon_data = {:rss2_id=> rss2_id, :award_date => award_date, :award_name_translations=> award_name_translations, :country_translations => country_translations, :ranking_translations => ranking_translations, :awarding_body_translations => awarding_body_translations, :awarding_unit_translations => awarding_unit_translations, :year => year, :member_profile => mp, :honor_type => type}
|
||||
if hon.nil?
|
||||
hon = Honor.create(hon_data)
|
||||
puts "Saving new Honor."
|
||||
|
|
Loading…
Reference in New Issue