noesya/osuny

View on GitHub
app/services/migrations/authors.rb

Summary

Maintainability
A
0 mins
Test Coverage
F
42%
module Migrations
  class Authors
    def self.migrate
      authors_ids = Communication::Website::Post.pluck(:author_id) + Communication::Extranet::Post.pluck(:author_id)
      authors_ids.uniq!
                 .compact!
      puts "#{authors_ids.count} authors"
      University::Person.where(id: authors_ids).update_all(is_author: true)
    end
  end
end