object_count.rb 591 B

123456789101112131415161718192021222324
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Sequencer::Unit::Import::Freshdesk::ObjectCount < Sequencer::Unit::Common::Provider::Attribute
  3. include ::Sequencer::Unit::Import::Common::Model::Statistics::Mixin::EmptyDiff
  4. prepend ::Sequencer::Unit::Import::Common::Model::Mixin::Skip::Action
  5. skip_action :skipped, :failed
  6. uses :model_class, :resources
  7. private
  8. def statistics_diff
  9. {
  10. model_key => empty_diff.merge!(
  11. total: resources.count
  12. )
  13. }
  14. end
  15. def model_key
  16. model_class.name.pluralize.to_sym
  17. end
  18. end