From 8d09fb9dd199a4e9f79afd9a0be4670bead784cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E5=8D=9A=E4=BA=9E?= Date: Tue, 2 Jul 2024 22:44:23 +0800 Subject: [PATCH] Fix get_sync_data_xml for book. --- lib/tasks/sync_ntu_personal_data_tasks.rake | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/tasks/sync_ntu_personal_data_tasks.rake b/lib/tasks/sync_ntu_personal_data_tasks.rake index eae0587..daad97b 100644 --- a/lib/tasks/sync_ntu_personal_data_tasks.rake +++ b/lib/tasks/sync_ntu_personal_data_tasks.rake @@ -86,8 +86,8 @@ module NtuSyncPlugin return res end - def self.get_sync_data_xml(ntuseq, type) - uri = URI.parse("https://my.ntu.edu.tw/achvservice/xmlpaper.asp?Seq=#{ntuseq}&type=#{type}") + def self.get_sync_data_xml(ntuseq, type, api_name="xmlpaper") + uri = URI.parse("https://my.ntu.edu.tw/achvservice/#{api_name}.asp?Seq=#{ntuseq}&type=#{type}") response = get_response(uri) return Nokogiri::XML(response.body) end @@ -204,7 +204,7 @@ module NtuSyncPlugin Book.where(member_profile_id: mp.id).destroy puts "Sync_Book:... #{u_account}." puts ntuseq - books_xml = get_sync_data_xml(ntuseq, "B") + books_xml = get_sync_data_xml(ntuseq, "B", "xmlBook") @books = books_xml.xpath("//Book").map do |book_node| { author: (book_node>"Authors").text,