From acbb318569349dac5e150a4ea7a12de7c6a8727e Mon Sep 17 00:00:00 2001 From: BoHung Chiu Date: Mon, 25 Sep 2023 19:13:21 +0800 Subject: [PATCH] Update fgu_sync.rake. --- fgu_sync.rake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fgu_sync.rake b/fgu_sync.rake index 7f3f227..6e996ab 100644 --- a/fgu_sync.rake +++ b/fgu_sync.rake @@ -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)