This commit is contained in:
BoHung Chiu 2022-08-23 10:34:26 +08:00
parent 752be34741
commit 8b13101c08
1 changed files with 12 additions and 12 deletions

View File

@ -50,7 +50,7 @@ module AsiaSyncPlugin
puts "Journal Paper for user: #{user.user_name}"
journal_papers = query_result["journal"].to_a
if !query_result['emp'].blank?
JournalPaper.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
JournalPaper.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>journal_papers.map{|v| v["ukey"]}).destroy
end
return if journal_papers.count == 0
journal_papers.each do |journal_paper|
@ -76,7 +76,7 @@ module AsiaSyncPlugin
puts "Conference Paper for user: #{user.user_name}"
conference_papers = query_result["conference"].to_a
if !query_result['emp'].blank?
WritingConference.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
WritingConference.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>conference_papers.map{|v| v["ukey"]}).destroy
end
return if conference_papers.count == 0
conference_papers.each do |conference_paper|
@ -99,7 +99,7 @@ module AsiaSyncPlugin
puts "Projects(Research Grants) for user: #{user.user_name}"
projects = query_result["research"].to_a
if !query_result['emp'].blank?
Project.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
Project.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>projects.map{|v| v["ukey"]}).destroy
end
return if projects.count == 0
projects.each do |project|
@ -125,7 +125,7 @@ module AsiaSyncPlugin
books = query_result["books"].to_a
books1 = query_result["books1"].to_a
if !query_result['emp'].blank?
Book.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
Book.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>(books + books1).map{|v| v["ukey"]}).destroy
end
return if (books.count == 0 && books1.count == 0)
books.each do |book|
@ -168,7 +168,7 @@ module AsiaSyncPlugin
puts "Patents for user: #{user.user_name}"
patents = query_result["patent"].to_a
if !query_result['emp'].blank?
Patent.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
Patent.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>patents.map{|v| v["ukey"]}).destroy
end
return if (patents.count == 0 )
patents.each do |patent|
@ -194,7 +194,7 @@ module AsiaSyncPlugin
puts "Honors(Awards) for user: #{user.user_name}"
honors = query_result["award"].to_a
if !query_result['emp'].blank?
Honor.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
Honor.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>honors.map{|v| v["ukey"]}).destroy
end
return if (honors.count == 0 )
honors.each do |honor|
@ -213,7 +213,7 @@ module AsiaSyncPlugin
puts "Activities(Shows) for user: #{user.user_name}"
activities = query_result["show"].to_a
if !query_result['emp'].blank?
Activity.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
Activity.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>activities.map{|v| v["ukey"]}).destroy
end
return if (activities.count == 0 )
activities.each do |activity|
@ -236,7 +236,7 @@ module AsiaSyncPlugin
puts "Courses(Course Information) for user: #{user.user_name}"
courses = query_result["cos_data"].to_a
if !query_result['emp'].blank?
Course.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
Course.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>courses.map{|v| v["ukey"]}).destroy
end
return if (courses.count == 0 )
courses.each do |course|
@ -277,7 +277,7 @@ module AsiaSyncPlugin
puts "Researches(Thesis Advisor) for user: #{user.user_name}"
researches = query_result["paper_data"].to_a
if !query_result['emp'].blank?
Research.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
Research.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>researches.map{|v| v["ukey"]}).destroy
end
return if (researches.count == 0 )
researches.each do |research|
@ -299,7 +299,7 @@ module AsiaSyncPlugin
puts "Create Designs for user: #{user.user_name}"
create_designs = query_result["create"].to_a
if !query_result['emp'].blank?
CreateDesign.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
CreateDesign.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>create_designs.map{|v| v["ukey"]}).destroy
end
return if (create_designs.count == 0 )
create_designs.each do |create_design|
@ -318,7 +318,7 @@ module AsiaSyncPlugin
puts "Technology Transfers for user: #{user.user_name}"
tec_transfers = query_result["tec_transfer"].to_a
if !query_result['emp'].blank?
TecTransfer.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
TecTransfer.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>tec_transfers.map{|v| v["ukey"]}).destroy
end
return if (tec_transfers.count == 0 )
tec_transfers.each do |tec_transfer|
@ -342,7 +342,7 @@ module AsiaSyncPlugin
puts "College Projects for user: #{user.user_name}"
college_projects = query_result["college_data"].to_a
if !query_result['emp'].blank?
CollegeProject.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).destroy
CollegeProject.where(member_profile_id: user.member_profile_id,:rss2_id.ne=>nil).where(:rss2_id.nin=>college_projects.map{|v| v["ukey"]}).destroy
end
return if (college_projects.count == 0 )
college_projects.each do |college_project|