From f43daaea66967c49aa6ffe8cf298ad33f3787c19 Mon Sep 17 00:00:00 2001 From: pabois <pierreandre.boissinot@noesya.coop> Date: Thu, 16 Dec 2021 11:42:56 +0100 Subject: [PATCH] import WP authors --- app/models/communication/website/imported/author.rb | 4 ++-- app/models/communication/website/imported/website.rb | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/models/communication/website/imported/author.rb b/app/models/communication/website/imported/author.rb index d88ec7538..e820c7957 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 8965a6d01..b5c6f3a19 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 -- GitLab