Fix experience missing rss2_id.

This commit is contained in:
邱博亞 2024-09-25 22:10:03 +08:00
parent b78bd2a39d
commit f235436e19
1 changed files with 16 additions and 4 deletions

View File

@ -237,10 +237,13 @@ module FguSyncPlugin
if type.nil?
type = ExperienceType.create(:title_translations => self.localize_data(dt["emp_type"]))
end
else
type = nil
end
Experience.where(:rss2_id => nil, :organizationt_title=> dt["organization_title"], :job_title => dt["job_title"], :member_profile => mp, :experience_type => type).destroy # destroy old data
exp = Experience.where(:rss2_id => rss2_id).first
exp_data = {:rss2_id => rss2_id, :start_date => start_date, :end_date => end_date, :organizationt_title_translations => organization_title, :job_title_translations => job_title, :member_profile => mp, :experience_type => type}
if exp.nil?
if exp.nil? || rss2_id.blank?
exp = Experience.create(exp_data)
puts "Saving new Exp."
else
@ -796,14 +799,16 @@ module FguSyncPlugin
"f_start" => "start_date",
"f_end" => "end_date",
"f_comp" => "organization_title",
"f_empname" => "job_title"
"f_empname" => "job_title",
"rss_id" => "rss2_id"
},
'vrul_inemp' => {
"f_start" => "start_date",
"f_end" => "end_date",
"f_unit" => "organization_title",
"f_empname" => "job_title",
"f_emptype" => "emp_type"
"f_emptype" => "emp_type",
"rss_id" => "rss2_id"
},
'dbo.v_rul_research_credential' => {
"紀錄編號" => "rss2_id",
@ -936,7 +941,10 @@ module FguSyncPlugin
end
def self.query_db(table_name, filter_params={})
order_fields = {} # true => order by first column with desc order
order_fields = {
'vrul_exp' => false,
'vrul_inemp' => false
} # true => order by first column with desc order
rss_id_offsets = {}
# rss_id_offsets = {
# 'rsspublish' => 1073443
@ -978,6 +986,8 @@ module FguSyncPlugin
h.each do |k,v|
if v.class == String
h[k] = v.strip
elsif v.class == BigDecimal
h[k] = v.to_i
end
end
tmp.each do |k,v|
@ -1033,6 +1043,8 @@ module FguSyncPlugin
h.each do |k,v|
if v.class == String
h[k] = v.strip
elsif v.class == BigDecimal
h[k] = v.to_i
end
end
end