Class: Eco::API::UseCases::Default::People::Migrate::RemapTags

Inherits:
Common::Loaders::UseCase show all
Defined in:
lib/eco/api/usecases/default/people/migrate/remap_tags_case.rb,
lib/eco/api/usecases/default/people/migrate/cli/remap_tags_cli.rb

Defined Under Namespace

Classes: Cli

Constant Summary collapse

REGISTER_TAGS =
%w[
  EVENT INJURY RISK CONTRACTOR PERMIT
  AUDIT JSEA
  TRAINING INDUCTION
  MEETING PPE CHEMICAL
  PLANT ASSET
  POLICY IDEA REPORTS
].freeze

Instance Attribute Summary

Attributes included from Language::AuxiliarLogger

#logger

Instance Method Summary collapse

Methods inherited from Common::Loaders::UseCase

cli, cli!, #cli_apply!, #initialize, type, #type

Methods inherited from Common::Loaders::CaseBase

#name, name_only_once!

Methods inherited from Common::Loaders::Base

<=>, created_at, #initialize, set_created_at!

Methods included from Common::ClassHelpers

#class_resolver, #descendants, #descendants?, #inheritable_attrs, #inheritable_class_vars, #inherited, #instance_variable_name, #new_class, #resolve_class, #to_constant

Methods included from Language::AuxiliarLogger

#log

Constructor Details

This class inherits a constructor from Eco::API::Common::Loaders::UseCase

Instance Method Details

#main(*_args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/eco/api/usecases/default/people/migrate/remap_tags_case.rb', line 16

def main(*_args)
  tune_options!

  people.each do |person|
    update_job.add(person)

    update_filter_tags!(person)
    update_default_tag!(person)
    clear_unkown_tags!(person)    if clear_unknown_tags?
    clear_archived_nodes!(person) if clear_archived_nodes?
  end
end

#update_jobObject



29
30
31
32
33
34
35
# File 'lib/eco/api/usecases/default/people/migrate/remap_tags_case.rb', line 29

def update_job
  @update_job ||= session.new_job('main', 'update', :update, usecase) do |_job, _job_status|
    report_removed_src_tags
    report_archived_cleared
    report_unknown_cleared
  end
end