diff --git a/app/models/communication/website/imported/author.rb b/app/models/communication/website/imported/author.rb index d88ec753838ada192d0e7d994b0be0404555c667..e820c79573c33ae61a2f971aee3ff82309143551 100644 --- a/app/models/communication/website/imported/author.rb +++ b/app/models/communication/website/imported/author.rb @@ -54,10 +54,10 @@ class Communication::Website::Imported::Author < ApplicationRecord def sync if author.nil? - self.author = Communication::Website::Author.new university: university, - website: website.website # Real website, not imported website + self.author = Administration::Member.new university: university self.author.last_name = "Doe" # No title yet self.author.first_name = "John" # No title yet + self.is_author = true self.author.save end puts "Update author #{author.id}" diff --git a/app/models/communication/website/imported/website.rb b/app/models/communication/website/imported/website.rb index 8965a6d01531f44e007c7380265b7c160ebd1be2..b5c6f3a19121529db50e9fd3e4430071e84beb69 100644 --- a/app/models/communication/website/imported/website.rb +++ b/app/models/communication/website/imported/website.rb @@ -60,16 +60,16 @@ class Communication::Website::Imported::Website < ApplicationRecord def sync_authors begin - skip_publish_callback(Communication::Website::Author) + skip_publish_callback(Administration::Member) wordpress.authors.each do |data| author = authors.where(university: university, identifier: data['id']).first_or_initialize author.data = data author.save end # Batch update all changes (1 query only, good for github API limits) - website.publish_authors! + website.publish_members! ensure - set_publish_callback(Communication::Website::Author) + set_publish_callback(Administration::Member) end end