Update fgu_sync.rake.

This commit is contained in:
BoHung Chiu 2023-09-25 19:13:21 +08:00
parent 1f071b5df0
commit acbb318569
1 changed files with 4 additions and 4 deletions

View File

@ -27,7 +27,7 @@ namespace :fgu_sync do
else
tmp_key = camelize(key)
end
tmp = attr_fields.select{|v| v[:title][:en].upcase.include?(tmp_key.upcase)}.first
tmp = attr_fields.select{|v| v.title_translations[:en].upcase.include?(tmp_key.upcase)}.first
value_flag ? data.where(:attribute_field_id => tmp.id).first : tmp
rescue => e
nil
@ -268,9 +268,9 @@ namespace :fgu_sync do
puts "Assigning role #{role.key}"
case dt["job_status"]
when "專任"
role_status = role.role_statuses.select{|v| v[:title][:en].upcase == "Full-Time".upcase}.first
role_status = role.role_statuses.select{|v| v.title_translations[:en].upcase == "Full-Time".upcase}.first
when "兼任"
role_status = role.role_statuses.select{|v| v[:title][:en].upcase == "Part-Time".upcase}.first
role_status = role.role_statuses.select{|v| v.title_translations[:en].upcase == "Part-Time".upcase}.first
else
role_status = nil
end
@ -379,7 +379,7 @@ namespace :fgu_sync do
end
def get_fgu_data(params_to_send)
uri = URI.parse("http://120.101.66.83/fgu/?plugin=#{params_to_send["plugin"]}&id=#{params_to_send["id"]}")
uri = URI.parse(URI.encode("http://120.101.66.83/fgu/?plugin=#{params_to_send["plugin"]}&id=#{params_to_send["id"]}"))
# uri = URI.parse("http://127.0.0.1/fgu/?plugin=#{params_to_send["plugin"]}&id=#{params_to_send["id"]}")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)