Created
May 10, 2018 07:15
-
-
Save descovi/8ed0952372f5f0a408c5e4664821cf62 to your computer and use it in GitHub Desktop.
Giacomo Counter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
businesses = Business.select{ |business| check_data_presence_for(business)} | |
previous_count = BusinessArea::RegisteredOffice.count | |
count = businesses.count.to_s | |
count_digits = count.length | |
cursors = ['|', '/', '-', '\\', '|', '/', '-', '\\'] | |
businesses.each.with_index(1) do |business, index| | |
cursor = cursors[index % 32 / 4] | |
formatted_index = index.to_s.rjust(count_digits, '0') | |
print "#{cursor} #{formatted_index}/#{count} (business #{business.id}) #{cursor}" | |
params = extract_params_from(business) | |
registered_office = BusinessArea::RegisteredOffice.new(params) | |
registered_office.save(validate: false) | |
end | |
current_count = BusinessArea::RegisteredOffice.count - previous_count | |
# Qui Giacomo faceva qualcosa ma Ale lo ha cancellato. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment