Newer
Older
dmpopidor / lib / data_cleanup / rules / annotation / fix_blank_text.rb
@Bodacious Bodacious on 10 Aug 2018 552 bytes Add rules to fix invalid Annotation records
# frozen_string_literal: true
module DataCleanup
  module Rules
    # Fix blank text on Annotation
    module Annotation

      class FixBlankText < Rules::Base

        def description
          "Fix blank text on Annotation"
        end

        def call
          ::Annotation.where(text: "").find_in_batches do |batches|
            batches.each do |annotation|
              log("Destroying Annotation##{annotation.id} since it has no text")
              annotation.destroy
            end
          end
        end

      end

    end
  end
end