Sha256: 8e33fca545d42799fd37f6d760c6c399962b7e9a88005fd2476d469358a4fde1

Contents?: true

Size: 1019 Bytes

Versions: 7

Compression:

Stored size: 1019 Bytes

Contents

namespace :exception_notification_server do
  desc 'Regenerate notification HASH'
  task regenerate_hash: :environment do
    notifications = ExceptionNotificationServer::Notification.order(:id).all
    exception_hashes = {}
    notifications.each do|notification|
      exception_hash = notification.send(:gen_exception_hash)
      exception_hashes[exception_hash] ||= []
      exception_hashes[exception_hash] << notification.id
    end
    base_notifications = ExceptionNotificationServer::Notification.where(id: exception_hashes.values.map(&:first))
    exception_hashes.each do |exception_hash, ids|
      base_notification = base_notifications.find { |notification| notification.id == ids.first }
      ExceptionNotificationServer::Notification.where(id: ids).update_all(exception_hash: exception_hash, parent_id: base_notification.id, status: base_notification.status)
      base_notification.remove_data if base_notification.status == 'fixed'
    end
    base_notifications.update_all(parent_id: nil)
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
exception_notification_server-0.0.11 lib/tasks/exception_notification_server_tasks.rake
exception_notification_server-0.0.10 lib/tasks/exception_notification_server_tasks.rake
exception_notification_server-0.0.9 lib/tasks/exception_notification_server_tasks.rake
exception_notification_server-0.0.8 lib/tasks/exception_notification_server_tasks.rake
exception_notification_server-0.0.7 lib/tasks/exception_notification_server_tasks.rake
exception_notification_server-0.0.6 lib/tasks/exception_notification_server_tasks.rake
exception_notification_server-0.0.5 lib/tasks/exception_notification_server_tasks.rake