Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix import_all_entities rake task output #147

Merged
merged 1 commit into from
Jun 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions lib/dfe/analytics/tasks/import_entities.rake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ namespace :dfe do
namespace :analytics do
desc 'Send Analytics events for the (allowlisted) state of all records in the database'
task :import_all_entities, %i[batch_size] => :environment do |_, args|
return unless DfE::Analytics.enabled?

puts 'DfE Analytics is not enabled - Ignoring import_all_entities'
unless DfE::Analytics.enabled?
puts 'DfE Analytics is not enabled - Ignoring import_all_entities'
return
end

entity_tag = Time.now.strftime('%Y%m%d%H%M%S')
DfE::Analytics.entities_for_analytics.each do |entity_name|
Expand All @@ -15,9 +16,10 @@ namespace :dfe do

desc 'Send Analytics events for the state of all records in a specified model'
task :import_entity, %i[entity_name batch_size] => :environment do |_, args|
return unless DfE::Analytics.enabled?

puts 'DfE Analytics is not enabled - Ignoring import_entity'
unless DfE::Analytics.enabled?
puts 'DfE Analytics is not enabled - Ignoring import_all_entities'
return
end

abort('You need to specify a model name as an argument to the Rake task, eg dfe:analytics:import_entity[Model]') unless args[:entity_name]
entity_tag = Time.now.strftime('%Y%m%d%H%M%S')
Expand Down
Loading