Sha256: 18dd060ca936fdac33a9847bfd07729dde6bbee07caa29bf40d155fab347f88d

Contents?: true

Size: 750 Bytes

Versions: 29

Compression:

Stored size: 750 Bytes

Contents

namespace :effective_cpd do

  # bundle exec rake effective_cpd:seed
  task seed: :environment do
    load "#{__dir__}/../../db/seeds.rb"
  end

  # bundle exec rake effective_cpd:notify_auditees
  desc 'Send cpd_audit_opened email notifications for effective cpd'
  task notify_auditees: :environment do
    audits = EffectiveCpd.CpdAudit.opened.sorted

    audits.find_each do |audit|
      begin
        audit.notify!
        puts "Sent #{audit} notification to #{audit.user.email}"
      rescue => e
        if defined?(ExceptionNotifier)
          ExceptionNotifier.notify_exception(e, data: { audit_id: audit.id })
        end

        puts "Error with audit #{auditee.id}: #{e.errors.inspect}"
      end
    end

    puts 'All done'
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
effective_cpd-1.7.2 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.7.1 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.7.0 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.6.5 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.6.4 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.6.3 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.6.2 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.6.1 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.6.0 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.5.1 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.5.0 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.8 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.7 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.6 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.5 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.4 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.3 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.2 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.1 lib/tasks/effective_cpd_tasks.rake
effective_cpd-1.4.0 lib/tasks/effective_cpd_tasks.rake