Class: DataShift::Reporters::BasicStdoutReporter

Inherits:
Reporter
  • Object
show all
Defined in:
lib/datashift/loaders/reporters/basic_stdout_reporter.rb

Instance Attribute Summary

Attributes inherited from Reporter

#progress_monitor

Instance Method Summary collapse

Methods included from Logging

#logdir, #logdir=, #logger, #verbose

Constructor Details

#initialize(progress_monitor) ⇒ BasicStdoutReporter

Returns a new instance of BasicStdoutReporter.



11
12
13
# File 'lib/datashift/loaders/reporters/basic_stdout_reporter.rb', line 11

def initialize(progress_monitor)
  super progress_monitor
end

Instance Method Details

#reportObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/datashift/loaders/reporters/basic_stdout_reporter.rb', line 15

def report
  loaded_objects = progress_monitor.loaded_objects

  loaded_objects.compact! if loaded_objects

  inbound_str = progress_monitor.processed_object_count > 1 ? 'entries' : 'entry'

  puts "\nProcessing Summary Report"
  puts ">>>>>>>>>>>>>>>>>>>>>>>>>\n"
  puts "Processed total of #{progress_monitor.processed_object_count} inbound #{inbound_str}"
  puts "#{loaded_objects.size}\tdatabase objects were successfully processed."
  puts "#{progress_monitor.success_inbound_count}\tinbound rows were successfully processed."

  failed_inbound_count = progress_monitor.failed_inbound_count

  if failed_inbound_count == 0
    puts 'There were NO failures.'
  else
    puts "WARNING : There were Failures - Check logs\n#{failed_inbound_count} rows contained errors"
    puts "#{progress_monitor.failed_objects.size} objects could not be saved to DB"
  end
end