Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanMendicutti committed Aug 24, 2023
1 parent 33f4c29 commit bf564a9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 1 addition & 3 deletions bin/entrypoint
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ def run_database_seeds
end

def load_db
if Rails.env.production? && ENV['DEPLOY_NAME'] == 'production'
Municipality.count.zero? && (bundle exec rake 'data:load')
end
system('rails data:load')
end

set_given_or_default_command
Expand Down
10 changes: 6 additions & 4 deletions lib/tasks/data.rake
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ namespace :data do

desc 'Sync data batch'
task load: %i[environment] do
load_db = LoadCsvToDatabase.new
load_db.on_load_progress { |message, _data| print_flush message }
load_db.perform!
if Rails.env.production? && ENV['DEPLOY_NAME'] == 'production' && Municipality.count.zero?
load_db = LoadCsvToDatabase.new
load_db.on_load_progress { |message, _data| print_flush message }
load_db.perform!
end
end
end
end

0 comments on commit bf564a9

Please sign in to comment.